1.10
Public Member Functions | List of all members
CopyOnWriteAllocate< T > Class Template Reference

Copy-On-Write wrapper for an object or container. More...

#include <cow.h>

Public Member Functions

 CopyOnWriteAllocate ()=default
 
 CopyOnWriteAllocate (const std::shared_ptr< T > &refptr)
 Construct with a shared_ptr to the object.
 
 CopyOnWriteAllocate (T *t)
 Construct with a pointer to the object. This now owns the pointer.
 
 operator bool () const
 Bool operator.
 
T & operator* ()
 Dereference operator.
 
const T & operator* () const
 Dereference operator. This will allocate.
 
T * operator-> ()
 Arrow operator.
 
const T * operator-> () const
 Arrow operator.
 

Detailed Description

template<class T>
class egt::v1::detail::CopyOnWriteAllocate< T >

Copy-On-Write wrapper for an object or container.

This creates copy on write semantics for an object. This also performs lazy initialization of the object and will automatically default construct it when needed.

Constructor & Destructor Documentation

◆ CopyOnWriteAllocate() [1/3]

template<class T >
CopyOnWriteAllocate ( )
default

◆ CopyOnWriteAllocate() [2/3]

template<class T >
CopyOnWriteAllocate ( T *  t)
inlineexplicit

Construct with a pointer to the object. This now owns the pointer.

◆ CopyOnWriteAllocate() [3/3]

template<class T >
CopyOnWriteAllocate ( const std::shared_ptr< T > &  refptr)
inlineexplicit

Construct with a shared_ptr to the object.

Member Function Documentation

◆ operator bool()

template<class T >
operator bool ( ) const
inlineexplicit

Bool operator.

◆ operator*() [1/2]

template<class T >
T & operator* ( )
inline

Dereference operator.

◆ operator*() [2/2]

template<class T >
const T & operator* ( ) const
inline

Dereference operator. This will allocate.

◆ operator->() [1/2]

template<class T >
T * operator-> ( )
inline

Arrow operator.

◆ operator->() [2/2]

template<class T >
const T * operator-> ( ) const
inline

Arrow operator.