我正在做一個C#項目,我想從C++的算法庫中調用next_permutation
。我找到了在c#中調用C++函數的方式,但我不知道如何從C++獲取向量並在c#中使用它(因爲next_permutation需要int向量...)C++ int vector to c#
這就是我現在正在嘗試的:
extern void NextPermutation(vector<int>& permutation)
{
next_permutation (permutation.begin(),permutation.end());
}
[DllImport("PEDLL.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern void NextPermutation(IntPtr test);
你需要一些膠水來轉換它。爲什麼不用C#來做呢?谷歌給我這個:http://code.google.com/p/monoalgorithm/source/browse/trunk/Algorithm.cs?spec=svn2&r=2#163 –