Internal::IntrusivePtr#

template<typename T>
struct IntrusivePtr#

Intrusive shared pointers have a reference count (a RefCount object) stored in the class itself.

This is perhaps more efficient than storing it externally, but more importantly, it means it’s possible to recover a reference-counted handle from the raw pointer, and it’s impossible to have two different reference counts attached to the same raw object. Seeing as we pass around raw pointers to concrete IRNodes and Expr’s interchangeably, this is a useful property.

Public Functions

inline T *get() const#

Access the raw pointer in a variety of ways.

Note that a “const IntrusivePtr<T>” is not the same thing as an IntrusivePtr<const T>. So the methods that return the ptr are const, despite not adding an extra const to T.