MCPcopy Create free account
hub / github.com/pybind/pybind11 / decRef

Method decRef

tests/object.h:29–36  ·  view source on GitHub ↗

\brief Decrease the reference count of * the object and possibly deallocate it. * * The object will automatically be deallocated once * the reference count reaches zero. */

Source from the content-addressed store, hash-verified

27 * the reference count reaches zero.
28 */
29 void decRef(bool dealloc = true) const {
30 --m_refCount;
31 if (m_refCount == 0 && dealloc) {
32 delete this;
33 } else if (m_refCount < 0) {
34 throw std::runtime_error("Internal error: reference count < 0!");
35 }
36 }
37
38 virtual std::string toString() const = 0;
39

Callers 2

~refMethod · 0.80
refClass · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected