Repeated destructor calls and tracking handles in C++/CLI
问题 I'm playing around with C++/CLI, using the MSDN documentation and the ECMA standard, and Visual C++ Express 2010. What struck me was the following departure from C++: For ref classes, both the finalizer and destructor must be written so they can be executed multiple times and on objects that have not been fully constructed. I concocted a little example: #include <iostream> ref struct Foo { Foo() { std::wcout << L"Foo()\n"; } ~Foo() { std::wcout << L"~Foo()\n"; this->!Foo(); } !Foo() { std: