Do all Standard C++ features work in C++/CLI? [duplicate]
If I just include existing Standard C++ class in C++/CLI program, will it work?
In my tests everything worked pretty good, but is it true for every progr开发者_开发知识库am?If you actually change the class to be a managed (gc) class, then no, it will sometimes break. In particular, the semantics of the delete operator is changed, as the objects are now managed by the garbage collector; deleting an object might not release any memory.
That is what Microsoft promises, yes. (I watched this video yesterday, in which they explicitly mentioned this -- specifically because the addition of nullptr
in C++0x would compromise it)
So yeah, if you take a native C++ program and compile it as C++/CLI, with no code changes, then yes, it will still work.
And of course, if you change your code (gcnew instead of new and other "managed" changes, then of course, all bets are off, and you might or might not break the code)
精彩评论