Does C++ have a Garbage Collector?

前端 未结 4 594
北荒
北荒 2020-12-11 01:21

I\'m currently reading an unreleased master thesis report, that I\'m going to give feedback on.

In the report they mention GC under native C++ and managed C++. I th

4条回答
  •  星月不相逢
    2020-12-11 01:52

    Managed C++ (and its successor C++/CLI) of course use .NET garbage collection for managed resources (though native resources are not garbage collected and have to be managed manually as in native C++).

    Native C++ by default has no such thing (the closest thing to this are the smart pointers, but that's still something entirely different), but that doesn't prevent you from writing your own garbage collection solution (or using third party solution).

提交回复
热议问题