How can I convert a managed array<String^>^ to std::vector<std::string>. The following code doesnt compile and I can't figure out why. Funny enough, if I use an int for example then it works fine. thanks in advance:
std::vector<std::string> ConvertToUnManaged(array<String^>^ ar)
{
using System::IntPtr;
using System::Runtime::InteropServices::Marshal;
std::vector<std::string> vector(ar->Length);
Marshal::Copy(ar, 0, IntPtr(&vector[0]), ar->Length);
return vector;
}