src/nub provides a base class, nub::object, with intrusive reference-counting. Objects deriving from nub::object can be stored in the nub::objectdb, which allows objects to be retrieved given their unique integer id (nub::uid). This, in turn, provides a basis for using these integer ids as object handles in a script-language wrapper of c++ classes and objects.
There are two basic smart pointer classes that can be used with nub::object; these are nub::ref and nub::soft_ref. The first, nub::ref, provides a strong guarantee that its pointee will never be null (this is verified upon construction of the nub::ref, after which the guarantee can never be lost). The second, nub::soft_ref, is more flexible in two ways: (1) it can have a null pointee, allowing for the representation of "no object here" (though it still verifies that its pointee is non-null upon dereferencing, and throws an exception if the pointee is null), and (2) it can act as a weak pointer, that is, one that doesn't prevent its pointee from being destroyed -- in this case if its pointee is destroyed, the the nub::soft_ref silently becomes null (but does not "dangle" like an ordinary pointer would).