我正在做一个 C# 项目,我想next_permutation
从 C++ 中的算法库中调用。我找到了在 c# 中调用 c++ 函数的方法,但我不知道如何从 c++ 获取向量并在 c# 中使用它(因为 next_permutation 需要一个 int 向量......)
这就是我目前正在尝试的:
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);