Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

[CONNECT C++] IRefCounted

$
0
0

IRefCounted and C++ Smart Pointers

[quote user="Brien Bastings"]If you sub-class from IRefCounted you'd increment an internal ref-count in AddRef, and decrement it in Release so that your instance is freed when it's no longer referenced[/quote]

How does Bentley RefCounted differ from C++ Smart Pointers?

Whereas a std::shared_pointer<> takes cares of incrementing & decrementing its internal reference count automatically, from your description it looks like a class that inherits from RefCounted must implement its own management.

When is it appropriate to derive from RefCounted, and when is it better to consider std::shared_pointer<>?


Viewing all articles
Browse latest Browse all 7260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>