Hey guys have some previous experience programming in matlab and vba and recently started to dig into some level languages looking for better perfomace. Honestly i have been sort of lost because there is a lot of avaible material on the internet and I don't find easy to manage all that information at once.
My question is why is not straight way to pass a vector or a range from a c++ code to vba? Everywhere I look there is a diferent explanation and it seems to be the same problem to me.
I'm trying to make solve a FDM scheme to price derivatives and I'm declaring as follows:
#include <cmath>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
double __stdcall FDM (double Price, double Strike, double Rf, double Vol, double T, int Steps)
{
double ds, dt;
double Nts;
double Delta=0, Gamma=0, Theta=0;
vector <double> S(Steps+1);
vector <double> Payoff(Steps+1);
vector <double> Vold(Steps+1);
vector <double> vnew(Steps+1);
...
SOME LOOPS
...
return vnew;
I compile it and get
Error1
error C2440: 'return' : cannot convert from 'std::vector<_Ty>' to 'double'
2IntelliSense: no suitable conversion function from "std::vector<double, std::allocator<double>>" to "double"
Honestly I dont know what to do with that. I would appriciate any help or guidance in to c++, specially in the above stated problem.
Many Thanks