我熟悉c ++ / cli。我正在编写一个名为Locate的函数,其中包含一个名为Locator的类。输入字符串字典的函数。
Dictionary<String^, array< Byte >^>^ Locate(Dictionary<String^, String^>^ imgParms)
我试图通过这样做在主函数中调用它:
Locator r;
Dictionary<String^,String^> myDictionary =
gcnew Dictionary<String^,String^>();
r.Locate(myDictionary);
但我收到此错误
error C3073: 'System::Collections::Generic::Dictionary<TKey,TValue>' : ref class does
not have a user-defined copy constructor with
[
TKey=System::String ^,
TValue=System::String ^
]
任何帮助都将不胜感激。
答案 0 :(得分:3)
Dictionary<String^,String^> myDictionary =
gcnew Dictionary<String^,String^>();
应该是
Dictionary<String^,String^>^ myDictionary =
gcnew Dictionary<String^,String^>();
可以将^
符号视为类型修饰符,例如*
gcnew会返回x^
来键入x