#include <dptr.h>
Public Member Functions | |
DPtr (const DPtr &other) | |
const DPtr & | operator= (const DPtr &other) |
RAII wrapper for implementing d-pointers. The resulting object can be copied through normal copy construction and assignment. Additionally it is compatible with all implicitly generated functions. (Note that implicitly generated functions are inlined so adding one to your class later will break your ABI.)
Use in your class declaration is fairly standard except that T should be the type of the class it is contained in. In your implementation file you will need to specialize PrivData<T> (which can be done with the DClass<T> macro). Additionally every member of this class must be specialized in the implementation file, which will usually be done with DPointered(T) or DPointeredNoCopy(T). The implementation of these functions is fairly trivial so they could be specialized manually as a way out of the previously mentioned ABI breakage.