The libcult memory management library provides non-intrusive reference counter and a couple of smart pointers.

It also overrides and overloads default memory management operators (operator new and operator delete) to allow special service objects (reference counter being one of them) to be constructed in the memory block preceding the instance. This allows transparent instrumentation of objects with a special functionality like reference counting or locking.

The two flavors of smart pointers are exclusive (called Evptr, from exclusive pointer) and shared (called Shptr, from shared pointer) pointers.

The exclusive pointer has semantics similar to std::auto_ptr (i.e., exclusive ownership of the object pointed to) except that it performs automatic copying of the object pointed to when copied or assigned to another exclusive pointer. Built-in copy-on-write optimization eliminates unnecessary copying when instances of exclusive pointers are returned from functions or stored in containers.

The shared pointer has standard semantics of a reference-counting smart pointer.

Copyright © 2005-2010 Boris Kolpackov.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, version 1.2; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts.