【发布时间】:2012-06-20 21:07:44
【问题描述】:
我正在做一个 C# 项目,我想从 C++ 的算法库中调用 next_permutation。我找到了在 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);
【问题讨论】:
-
你需要一些胶水来转换它。为什么不直接在 C# 中做呢?谷歌给我这个:code.google.com/p/monoalgorithm/source/browse/trunk/…