lean cpp library
A lean C++ library providing efficient utility classes for high-performance C++ applications.
|
Simple and fast vector class, partially implementing the STL vector interface. More...
#include <simple_vector.h>
Public Types | |
typedef Policy | construction_policy |
Construction policy used. | |
typedef allocator_type_ | allocator_type |
Type of the allocator used by this vector. | |
typedef size_type_ | size_type |
Type of the size returned by this vector. | |
typedef allocator_type::difference_type | difference_type |
Type of the difference between the addresses of two elements in this vector. | |
typedef allocator_type::pointer | pointer |
Type of pointers to the elements contained by this vector. | |
typedef allocator_type::const_pointer | const_pointer |
Type of constant pointers to the elements contained by this vector. | |
typedef allocator_type::reference | reference |
Type of references to the elements contained by this vector. | |
typedef allocator_type::const_reference | const_reference |
Type of constant references to the elements contained by this vector. | |
typedef allocator_type::value_type | value_type |
Type of the elements contained by this vector. | |
typedef pointer | iterator |
Type of iterators to the elements contained by this vector. | |
typedef const_pointer | const_iterator |
Type of constant iterators to the elements contained by this vector. | |
Public Member Functions | |
simple_vector () | |
Constructs an empty vector. | |
simple_vector (allocator_type allocator) | |
Constructs an empty vector. | |
simple_vector (const simple_vector &right) | |
Copies all elements from the given vector to this vector. | |
~simple_vector () | |
Destroys all elements in this vector. | |
simple_vector & | operator= (const simple_vector &right) |
Copies all elements of the given vector to this vector. | |
template<class Iterator > | |
void | assign (Iterator source, Iterator sourceEnd) |
Assigns the given range of elements to this vector. | |
template<class Iterator > | |
void | assign_disj (Iterator source, Iterator sourceEnd) |
Assigns the given disjoint range of elements to this vector. | |
LEAN_INLINE reference | push_back () |
Appends a default-constructed element to this vector. | |
LEAN_INLINE void | push_back (const value_type &value) |
Appends the given element to this vector. | |
LEAN_INLINE void | pop_back () |
Removes the last element from this vector. | |
LEAN_INLINE void | clear () |
Clears all elements from this vector. | |
LEAN_INLINE void | reserve (size_type newCapacity) |
Reserves space for the predicted number of elements given. | |
void | resize (size_type newCount) |
Resizes this vector, either appending empty elements to or removing elements from the back of this vector. | |
LEAN_INLINE reference | at (size_type pos) |
Gets an element by position, access violation on failure. | |
LEAN_INLINE const_reference | at (size_type pos) const |
Gets an element by position, access violation on failure. | |
LEAN_INLINE reference | front (void) |
Gets the first element in the vector, access violation on failure. | |
LEAN_INLINE const_reference | front (void) const |
Gets the first element in the vector, access violation on failure. | |
LEAN_INLINE reference | back (void) |
Gets the last element in the vector, access violation on failure. | |
LEAN_INLINE const_reference | back (void) const |
Gets the last element in the vector, access violation on failure. | |
LEAN_INLINE reference | operator[] (size_type pos) |
Gets an element by position, access violation on failure. | |
LEAN_INLINE const_reference | operator[] (size_type pos) const |
Gets an element by position, access violation on failure. | |
LEAN_INLINE iterator | begin (void) |
Returns an iterator to the first element contained by this vector. | |
LEAN_INLINE const_iterator | begin (void) const |
Returns a constant iterator to the first element contained by this vector. | |
LEAN_INLINE iterator | end (void) |
Returns an iterator beyond the last element contained by this vector. | |
LEAN_INLINE const_iterator | end (void) const |
Returns a constant iterator beyond the last element contained by this vector. | |
LEAN_INLINE allocator_type | get_allocator () const |
Gets a copy of the allocator used by this vector. | |
LEAN_INLINE bool | empty (void) const |
Returns true if the vector is empty. | |
LEAN_INLINE size_type | size (void) const |
Returns the number of elements contained by this vector. | |
LEAN_INLINE size_type | capacity (void) const |
Returns the number of elements this vector could contain without reallocation. | |
size_type | next_capacity_hint (size_type count) const |
Computes a new capacity based on the given number of elements to be stored. | |
LEAN_INLINE size_type | max_size () const |
Estimates the maximum number of elements that may be constructed. | |
LEAN_INLINE void | swap (simple_vector &right) throw () |
Swaps the contents of this vector and the given vector. |
Simple and fast vector class, partially implementing the STL vector interface.