I want to have a vector that has a number of independent variables. In my C++ header(.h) I defined it like this:
private:
// Static data structure holding independent variables
static vector<double>* indVariables;
And in my .cpp file it is defined the same and then I'm going to have to use this vector in some other function like this:
static vector<double>* indVariables;
void fun(int m, int n)
{
for (i = 0; i < m; ++i)
{
ai = indVariables[i];
temp = exp(-n * (ai - 8.0));
}
} /* fun */
Now in C# I want to copy a set of numbers to this vector and call it back to C++ something like this:
var matu = new double[]{ 8.0, 8.0, 10.0, 10.0, 10.0, 10.0};
myCppClass.indVariables = matu;
How can I do it?
The first problem is because it is private I don't see it in C#. Do I have to make it public or are there other ways? And then how can I assign values to this vector?
std::vectordoes not exist in C#. You should write a function that converts astd::vectorto a C#Listwith C++/CLI code. - Richard Dally