M
marco_segurini
Hi,
the build of the following code returns me an error.
So I am wondering what is the right way to pass ta a function a
parameter that is a reference to an array item of value struct.
TIA.
Marco.
using namespace stdcli::language;
value struct MyInt
{
int i;
};
void Set(MyInt & item, int set)
{
item.i = set;
}
void Set(array<MyInt>^ vInt)
{
for (int Pos=0; Pos<vInt->Length; ++Pos)
{
Set(vInt[Pos], Pos);
}
}
int main()
{
array<MyInt>^ vInt = gcnew array<MyInt>(5);
Set(vInt);
return 0;
}
Value.cpp(17) : error C2665: 'Set' : none of the 2 overloads could
convert all the argument types
Value.cpp(8): could be 'void Set(MyInt &,int)'
while trying to match the argument list '(MyInt, int)'
the build of the following code returns me an error.
So I am wondering what is the right way to pass ta a function a
parameter that is a reference to an array item of value struct.
TIA.
Marco.
using namespace stdcli::language;
value struct MyInt
{
int i;
};
void Set(MyInt & item, int set)
{
item.i = set;
}
void Set(array<MyInt>^ vInt)
{
for (int Pos=0; Pos<vInt->Length; ++Pos)
{
Set(vInt[Pos], Pos);
}
}
int main()
{
array<MyInt>^ vInt = gcnew array<MyInt>(5);
Set(vInt);
return 0;
}
Value.cpp(17) : error C2665: 'Set' : none of the 2 overloads could
convert all the argument types
Value.cpp(8): could be 'void Set(MyInt &,int)'
while trying to match the argument list '(MyInt, int)'