Basic Geometry, Numerical Algorithms and Interfaces
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
Public Member Functions | Private Attributes | List of all members
SharedVector< Type > Class Template Reference

Detailed Description

template<class Type>
class SharedVector< Type >

Shared pointer to vector.

Implements shared-object semantics for std::vector. An object of type SharedVector<> can be used in the same way as std::vector<>, but it can also be passed by value and copied cheaply as it only holds a reference-counted pointer to the underlying vector.

All of the member functions should work as for std::vector. The only additional function detach() can be used to obtain a unique copy of the current object - use this if you want a real copy in order to modify the contents of the copy without changing the original.

#include <sharedvector.h>

Public Member Functions

 SharedVector ()
 empty construction
 SharedVector (size_t n)
 sized construction
 SharedVector (size_t n, const Type &t)
 sized construction
Type & operator[] (size_t i)
 mutable access
const Type & operator[] (size_t i) const
 const access
void detach ()
 make *this a deep copy of the original

Private Attributes

VectorPtr ptr
 shared pointer to vector object

The documentation for this class was generated from the following file: