#include <ustl.h>
Inheritance diagram for ustl::vector< T >:
Public Types | |
typedef T | value_type |
typedef value_type * | pointer |
typedef const value_type * | const_pointer |
typedef value_type & | reference |
typedef const value_type & | const_reference |
typedef pointer | iterator |
typedef const_pointer | const_iterator |
typedef ::ustl::reverse_iterator< iterator > | reverse_iterator |
typedef ::ustl::reverse_iterator< const_iterator > | const_reverse_iterator |
Public Member Functions | |
vector (void) | |
Initializes empty vector. | |
vector (size_type n) | |
Initializes a vector of size n . | |
vector (size_type n, const T &v) | |
Copies n elements from v . | |
vector (const vector< T > &v) | |
Copies v . | |
vector (const_iterator i1, const_iterator i2) | |
Copies range [i1 , i2 ]. | |
virtual | ~vector (void) |
const vector< T > & | operator= (const vector< T > &v) |
Copies contents of v . | |
void | reserve (size_type n) |
Allocates space for at least n elements. | |
void | resize (size_type n) |
Resizes the vector to contain n elements. | |
size_type | capacity (void) const |
Returns the number of bytes allocated. | |
size_type | size (void) const |
Returns the size of the block. | |
iterator | begin (void) |
Returns a modifiable pointer to the block. | |
const_iterator | begin (void) const |
Returns a const pointer to the block. | |
iterator | end (void) |
Returns a modifiable pointer to the end of the block. | |
const_iterator | end (void) const |
Returns a const pointer to the end of the block. | |
reverse_iterator | rbegin (void) |
const_reverse_iterator | rbegin (void) const |
reverse_iterator | rend (void) |
const_reverse_iterator | rend (void) const |
reference | at (size_type i) |
const_reference | at (size_type i) const |
reference | operator[] (size_type i) |
const_reference | operator[] (size_type i) const |
reference | front (void) |
Returns the reference to the first element. | |
const_reference | front (void) const |
Returns the const reference to the first element. | |
reference | back (void) |
Returns the reference to the last element. | |
const_reference | back (void) const |
Returns the const reference to the last element. | |
void | push_back (const T &v=T()) |
Inserts value v at the end of the vector. | |
void | assign (const_iterator i1, const_iterator i2) |
Copies the range [i1 , i2 ]. | |
void | assign (size_type n, const T &v) |
Copies n elements with value v . | |
iterator | insert (iterator ip, const T &v=T()) |
Inserts value v at offset ip . | |
iterator | insert (iterator ip, size_type n, const T &v) |
Inserts n elements with value v at offsets ip . | |
iterator | insert (iterator ip, const_iterator i1, const_iterator i2) |
Inserts range [i1 , i2 ] at offset ip . | |
iterator | erase (iterator ep, size_type n=1) |
Removes count elements at offset ep . | |
iterator | erase (iterator ep1, iterator ep2) |
Removes elements from ep1 to ep2 . | |
void | link (const void *p, size_type n) |
Attaches the object to pointer p of size n . | |
void | link (void *p, size_type n) |
Initializes both links to point to p , n . | |
void | link (const vector< T > &v) |
void | link (vector< T > &v) |
void | link (const void *first, const void *last) |
Links to iterator range first - last . | |
void | link (void *first, void *last) |
Links to iterator range first - last . | |
virtual size_type | elementSize (void) const |
Returns the size of the atomic element in the block, if any. | |
size_type | elementBytes (size_type n) const |
Protected Member Functions | |
virtual void | constructBlock (void *p, size_type s) const |
Calls T() for every element. Because storage is allocated by malloc() in memblock::Reserve(), the constructors must be explicitly called here. | |
virtual void | destructBlock (void *p, size_type s) const |
Calls ~T() for every element. Because storage is deallocated by free() in memblock::Link(), the destructors must be explicitly called here. This function must also be called from the destructor of this class because it is virtual and cannot be called from ~memblock(). |
In this design elements frequently undergo BITWISE COPY! Don't put it in here if it doesn't support it.
|
Destructor Here the class must call deallocate, which is overloaded in this template to call destructors on all the elements. ~memblock does this too, but by the time the code gets there, the destructBlock overload is gone. |
|
Attaches the object to pointer
If Reimplemented from ustl::memlink. |