Defined in <stlab/copy_on_write.hpp>
template <typename T>
class copy_on_write

A copy-on-write wrapper for any type that models RegularType.

Copy-on-write sematics allow for an object to be lazily copied - only creating a copy when 1) the value is modified, and 2) there is more than one reference to the value.

copy_on_write is thread safe, and supports types that model MoveableType.

Member types

Member type Definition
value_type T The type of value stored [[deprecated]]
element_type T The type of value stored

Member Functions

(constructor) Constructs a copy_on_write
(destructor) Default-destructs a copy_on_write

Used to see if two copy_on_write items refer to the same instance.

Assigns a copy_on_write

Obtain a const reference to the underlying object.

Obtain a const reference to the underlying object.

Obtain a const reference to the underlying object.

Obtain a const reference to the underlying object.

Returns if the object instance reference count is one

Obtain a reference to the value the object is referencing.