C ++ / CLI对象^%(插入符号百分号)声明是什么意思? [英] What does the C++/CLI Object^% (caret percent-sign) declaration mean?
问题描述
这显然是一个Google防御术语,因为我不能得到任何搜索引擎,不要抛弃额外的字符。我也在C ++的参考中看MSDN,但我似乎找不到C ++ / CLI引用,因为在它的声明部分没有任何东西。
This apparently is a Google-proof term since I can't get any search engines to not throw away the "extra" characters. I did also look on MSDN in the C++ reference but I can't seem to find the C++/CLI reference because there is nothing in the declarations section on it.
推荐答案
%
是一个跟踪引用。
它类似于本机引用( Object&
),但跟踪引用可以引用CLR对象,而本机引用不能。区别是必要的,因为垃圾回收器可以移动CLR对象,所以CLR对象的内存地址可能会改变。
It is similar to a native reference (Object&
), but a tracking reference can reference a CLR object while a native reference cannot. The distinction is necessary because the garbage collector can move CLR objects around, so a CLR-object's memory address may change.
The ^
simply means it is managed. See MSDN and also this SO post.
这篇关于C ++ / CLI对象^%(插入符号百分号)声明是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!