公共成员的签名包含本机类型 [英] signature of public member contains native type

查看:300
本文介绍了公共成员的签名包含本机类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用sta :: map< std :: string,std :: string>时出错作为返回类型的方法。我想在外面使用这个方法,以便声明为public。

请给我解决方案。

I am getting error while using sta::map<std::string,std::string> as return type of method . I wanted to use this method in outside so that declared as public .
Can please give me solution .

推荐答案

鉴于错误信息,我猜您的代码是混合模式下的C ++ / CLI代码。在这种情况下,托管类型中的任何公共函数都必须使用托管类型。



您必须弄清楚如何将托管代码与非托管代码分开。这样做的方法取决于问题以及管理哪些代码以及哪些代码是原生代码。



顺便提一下,你应该提供更多信息。最佳解决方案取决于许多因素,例如您拥有多少本机代码和托管代码,以及您是否期望本机或托管呼叫者或两者兼而有之。此外,实现必须是本机的或管理的,或者两者都可以。
Given the error message, I guess that your code is C++/CLI code in mixed mode. In such case, any public functions in a managed type must use managed types.

You have to figure out how to separate managed code from unmanaged code. The way to do it depends on the problem and which code is managed and which code is native.

By the way for better answer, you should provide more information. The best solution depends on many factor such as how much native and managed code you have and if you expect native or managed callers or both. Also does the implementation have to be native or managed or either would works.


非常感谢。



我正在使用std :: map表示返回值,但现在我正在使用Platform String。现在,我没有收到错误。
Thank you very much.

I was using std::map for return value but now I am using Platform String . Now, I am not getting error.


这篇关于公共成员的签名包含本机类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆