Is C++/CLI's pin_ptr the equivalent of C#'s fixed statement?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Yes, pretty much.
Some differences:
- A
fixed
statement creates its own scope block.pin_ptr
's scope is from its initialization to the end of the enclosing block. fixed
is an explicit language feature.(See comments.)pin_ptr
is a use of a general language feature (C++ templates).
There are probably more differences like the above. But, when translating between the two languages, they are generally equivalent.