What does the ^ character mean when used in C++ declarations? [duplicate]

◇◆丶佛笑我妖孽 提交于 2019-12-10 14:42:03

问题


Possible Duplicate:
What does the caret (‘^’) mean in C++/CLI?
In C++/CLR, what does a hat character ^ do?

What does the ^ character mean in C++ when applied to the data type in a variable declaration, as in:

String^ input;

or

List<String^>^ phoneNumbers;

回答1:


Assuming a Microsoft-compiler, this is not from C++ but from Microsoft own C++ dialects called C++/CLI. It denotes a .NET-garbage collected object.




回答2:


It's a managed pointer. Similar to *, but collected by the GC.

Oh yeah, and it only works in C++/CLI, obviously (your post was already tagged cli, but I feel the need to explicitly state this).



来源:https://stackoverflow.com/questions/13953002/what-does-the-character-mean-when-used-in-c-declarations

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!