STXXL
1.4-dev
|
Vector that avoids copying of ValueType objects in push_back() (here: swap_back()) and resize() operations.
Values are swapped with default-constructed instances instead. Important: A template spezialization for std::swap(ValueType&,ValueType&) must be provided. Make shure the swap implementation is located above these lines.
Definition at line 34 of file swap_vector.h.
Public Types | |
typedef const value_type * | const_iterator |
typedef const value_type & | const_reference |
typedef value_type * | iterator |
typedef value_type & | reference |
typedef size_t | size_type |
typedef ValueType | value_type |
Public Member Functions | |
swap_vector () | |
Create an empty vector. More... | |
swap_vector (size_type size) | |
Create a vector with the spezified size. More... | |
swap_vector (size_type size, size_type capacity) | |
Create a vector with the spezified size and reserve (possibly more) space. More... | |
~swap_vector () | |
Delete the vector. More... | |
reference | back () |
Return reference to last element. More... | |
const_reference | back () const |
Return reference to last element. More... | |
iterator | begin () |
Return mutable iterator to the first element. More... | |
const_iterator | begin () const |
Return constant iterator to the first element. More... | |
size_type | capacity () const |
Return the size of the underlaying array. More... | |
const_iterator | cbegin () const |
Return constant iterator to the first element. More... | |
const_iterator | cend () const |
Return constant iterator beyond the last element. More... | |
void | clear () |
Clear the vector. The capacity doesn't change. More... | |
iterator | data () |
Return iterator to the beginning of vector. More... | |
const_iterator | data () const |
Return iterator to the beginning of vector. More... | |
bool | empty () const |
Return the vector size. More... | |
iterator | end () |
Return mutable iterator beyond the last element. More... | |
const_iterator | end () const |
Return constant iterator beyond the last element. More... | |
iterator | erase (iterator position) |
Erase the element at the given position by swapping it to the and and then reducing the vector size. More... | |
iterator | erase (iterator first, iterator last) |
Erase the elements at in the range [begin,last) by swapping them to the and and then reducing the vector size. More... | |
reference | front () |
Return reference to first element. More... | |
const_reference | front () const |
Return constant reference to first element. More... | |
reference | operator[] (size_type i) |
Return the i-th position of the vector. More... | |
const_reference | operator[] (size_type i) const |
Return constant reference to the i-th position of the vector. More... | |
void | reserve (size_type newsize) |
Resize the underlaying array to contain at least newsize items. More... | |
void | resize (size_type newsize) |
Resize the vector to contain at least newsize items. More... | |
size_type | size () const |
Return the vector size. More... | |
void | swap (swap_vector &obj) |
Swap the vector with another one. More... | |
void | swap_back (reference val) |
Create a new value_type object at the end of the vector and then swap it with val. More... | |
Protected Attributes | |
value_type * | m_array |
pointer to allocated memory area More... | |
size_type | m_capacity |
size of allocated memory More... | |
size_type | m_size |
size of vector More... | |
Additional Inherited Members | |
Private Member Functions inherited from stxxl::noncopyable | |
noncopyable () | |
typedef const value_type* stxxl::swap_vector< ValueType >::const_iterator |
Definition at line 54 of file swap_vector.h.
typedef const value_type& stxxl::swap_vector< ValueType >::const_reference |
Definition at line 56 of file swap_vector.h.
typedef value_type* stxxl::swap_vector< ValueType >::iterator |
Definition at line 53 of file swap_vector.h.
typedef value_type& stxxl::swap_vector< ValueType >::reference |
Definition at line 55 of file swap_vector.h.
typedef size_t stxxl::swap_vector< ValueType >::size_type |
Definition at line 38 of file swap_vector.h.
typedef ValueType stxxl::swap_vector< ValueType >::value_type |
Definition at line 37 of file swap_vector.h.
|
inline |
Create an empty vector.
Definition at line 60 of file swap_vector.h.
|
inline |
Create a vector with the spezified size.
Definition at line 64 of file swap_vector.h.
|
inline |
Create a vector with the spezified size and reserve (possibly more) space.
Definition at line 72 of file swap_vector.h.
|
inline |
Delete the vector.
Definition at line 87 of file swap_vector.h.
|
inline |
Return reference to last element.
Definition at line 171 of file swap_vector.h.
|
inline |
Return reference to last element.
Definition at line 177 of file swap_vector.h.
|
inline |
Return mutable iterator to the first element.
Definition at line 117 of file swap_vector.h.
|
inline |
Return constant iterator to the first element.
Definition at line 122 of file swap_vector.h.
|
inline |
Return the size of the underlaying array.
Definition at line 102 of file swap_vector.h.
|
inline |
Return constant iterator to the first element.
Definition at line 127 of file swap_vector.h.
|
inline |
Return constant iterator beyond the last element.
Definition at line 142 of file swap_vector.h.
|
inline |
Clear the vector. The capacity doesn't change.
Definition at line 224 of file swap_vector.h.
|
inline |
Return iterator to the beginning of vector.
Definition at line 107 of file swap_vector.h.
|
inline |
Return iterator to the beginning of vector.
Definition at line 112 of file swap_vector.h.
|
inline |
Return the vector size.
Definition at line 97 of file swap_vector.h.
|
inline |
Return mutable iterator beyond the last element.
Definition at line 132 of file swap_vector.h.
|
inline |
Return constant iterator beyond the last element.
Definition at line 137 of file swap_vector.h.
|
inline |
Erase the element at the given position by swapping it to the and and then reducing the vector size.
Definition at line 230 of file swap_vector.h.
|
inline |
Erase the elements at in the range [begin,last) by swapping them to the and and then reducing the vector size.
Definition at line 236 of file swap_vector.h.
|
inline |
Return reference to first element.
Definition at line 159 of file swap_vector.h.
|
inline |
Return constant reference to first element.
Definition at line 165 of file swap_vector.h.
|
inline |
Return the i-th position of the vector.
Definition at line 147 of file swap_vector.h.
|
inline |
Return constant reference to the i-th position of the vector.
Definition at line 153 of file swap_vector.h.
|
inline |
Resize the underlaying array to contain at least newsize items.
Definition at line 183 of file swap_vector.h.
|
inline |
Resize the vector to contain at least newsize items.
Definition at line 206 of file swap_vector.h.
|
inline |
Return the vector size.
Definition at line 92 of file swap_vector.h.
|
inline |
Swap the vector with another one.
Definition at line 79 of file swap_vector.h.
|
inline |
Create a new value_type object at the end of the vector and then swap it with val.
Definition at line 213 of file swap_vector.h.
|
protected |
pointer to allocated memory area
Definition at line 48 of file swap_vector.h.
Referenced by stxxl::swap_vector< external_array_type >::swap().
|
protected |
size of allocated memory
Definition at line 45 of file swap_vector.h.
Referenced by stxxl::swap_vector< external_array_type >::swap().
|
protected |
size of vector
Definition at line 42 of file swap_vector.h.
Referenced by stxxl::swap_vector< external_array_type >::swap().