copy_on_write Class Reference
Detailed Description
Copy-on-write sematics allow for object to be lazily copied - only creating a copy when the value is modified and there is more than one reference to the value.
Member Typedef Documentation
The type of allocator. Definition at line 77 of file copy_on_write.hpp.
The type of value stored. Definition at line 75 of file copy_on_write.hpp. Constructor & Destructor Documentation
The first call to the default constructor will construct a default instance of value_type which will be used for subsequent calls to the default constructor. The default instance will be released at exit. Definition at line 91 of file copy_on_write.hpp.
Initializes the instance with a custom allocator Definition at line 101 of file copy_on_write.hpp.
Constructs a new copy_on_write object with a value
Definition at line 116 of file copy_on_write.hpp.
Copy construction is a non-throwing operation and simply increments the reference count on the stored object. Definition at line 124 of file copy_on_write.hpp.
Definition at line 131 of file copy_on_write.hpp.
Definition at line 137 of file copy_on_write.hpp. Member Function Documentation
Definition at line 271 of file copy_on_write.hpp.
identity is used to see if two copy_on_write items refer to the same instance.
Definition at line 247 of file copy_on_write.hpp.
Obtain a const reference to the underlying object.
Definition at line 201 of file copy_on_write.hpp.
Obtain a const reference to the underlying object. This is provided because you cannot override
Definition at line 214 of file copy_on_write.hpp.
Obtain a const pointer to the underlying object. This is provided because you cannot override
Definition at line 227 of file copy_on_write.hpp.
As with copy construction, assignment is a non-throwing operation which releases the old value and increments the reference count of the item being assigned to. Definition at line 147 of file copy_on_write.hpp.
Definition at line 151 of file copy_on_write.hpp.
Obtain a const reference to the underlying object.
Definition at line 190 of file copy_on_write.hpp.
unique_instance returns whether or not the reference count to the object instance is one. This is useful to determine if writing will cause a copy.
Definition at line 237 of file copy_on_write.hpp.
Obtain a reference to the value the object is referencing. This will copy the underlying value (if necessary) so changes to the value do not affect other copy_on_write objects. Note that write() does not have the same preconditions as operator=(). write() returns a reference to the underlying object's value, thus requiring that an underlying object exist. operator=() on the other hand will perform an allocation if one is necessary.
Definition at line 175 of file copy_on_write.hpp. Friends And Related Function Documentation
Definition at line 268 of file copy_on_write.hpp.
Definition at line 253 of file copy_on_write.hpp.
Definition at line 259 of file copy_on_write.hpp.
Definition at line 265 of file copy_on_write.hpp.
Definition at line 256 of file copy_on_write.hpp.
Definition at line 262 of file copy_on_write.hpp.
Definition at line 250 of file copy_on_write.hpp. |