|
blocxx
|
Array<> wraps std::vector<> in COWReference<> adding ref counting and copy on write capability. More...
#include <Array.hpp>
Public Types | |
| typedef V::value_type | value_type |
| typedef V::pointer | pointer |
| typedef V::const_pointer | const_pointer |
| typedef V::iterator | iterator |
| typedef V::const_iterator | const_iterator |
| typedef V::reference | reference |
| typedef V::const_reference | const_reference |
| typedef V::size_type | size_type |
| typedef V::difference_type | difference_type |
| typedef V::reverse_iterator | reverse_iterator |
| typedef V::const_reverse_iterator | const_reverse_iterator |
Public Member Functions | |
| Array () | |
| Default Constructor. More... | |
| ~Array () | |
| Destructor. More... | |
| Array (V *toWrap) | |
| Constructor. More... | |
| Array (size_type n, const T &value) | |
| Construct an Array that consist of a specified number of elements that are copies of a given object. More... | |
| Array (int n, const T &value) | |
| Construct an Array that consist of a specified number of elements that are copies of a given object. More... | |
| Array (long n, const T &value) | |
| Construct an Array that consist of a specified number of elements that are copies of a given object. More... | |
| Array (size_type n) | |
| Construct an Array that consist of a specified number of elements that have be constructed using the default constructor of class T. More... | |
| template<class InputIterator > | |
| Array (InputIterator first, InputIterator last) | |
| Construct an Array from a range specified with InputIterators. More... | |
| iterator | begin () |
| const_iterator | begin () const |
| iterator | end () |
| const_iterator | end () const |
| reverse_iterator | rbegin () |
| const_reverse_iterator | rbegin () const |
| reverse_iterator | rend () |
| const_reverse_iterator | rend () const |
| size_type | size () const |
| size_type | max_size () const |
| size_type | capacity () const |
| bool | empty () const |
| reference | operator[] (size_type n) |
| Retrieve A read/write reference to an object in the Array at a given index. More... | |
| const_reference | operator[] (size_type n) const |
| Retrieve A read only reference to an object in the Array at a given index. More... | |
| Array< T > & | operator+= (const T &x) |
| Append an object to the end of the Array. More... | |
| void | reserve (size_type n) |
| Ensure the capacity is at least the size of a given value. More... | |
| reference | front () |
| const_reference | front () const |
| reference | back () |
| const_reference | back () const |
| void | push_back (const T &x) |
| Append an element to the end of the Array. More... | |
| void | append (const T &x) |
| Append an element to the end of the Array. More... | |
| void | swap (Array< T > &x) |
| Swap the elements of this Array with the elements of another. More... | |
| iterator | insert (iterator position, const T &x) |
| Insert an element in the Array before an element specified by an iterator. More... | |
| void | insert (size_type position, const T &x) |
| Insert an element in the Array before an element specified by an index. More... | |
| void | remove (size_type index) |
| Remove an element from the Array at a given index. More... | |
| void | remove (size_type begin, size_type end) |
| Remove an element specified by a range. More... | |
| template<class InputIterator > | |
| void | insert (iterator position, InputIterator first, InputIterator last) |
| Insert a range of elements before a given position in the Array. More... | |
| void | appendArray (const Array< T > &x) |
| Append the elements of another Array to the end of this Array. More... | |
| void | pop_back () |
| Remove the last element of the Array. More... | |
| iterator | erase (iterator position) |
| Remove an element of the Array specified with an iterator. More... | |
| iterator | erase (iterator first, iterator last) |
| Remove elements of the Array specified by a beginning and ending iterator. More... | |
| void | resize (size_type new_size, const T &x) |
| Ensure the Array is a given size. More... | |
| void | resize (size_type new_size) |
| Ensure the Array is a given size. More... | |
| void | clear () |
| Remove all items from the Array. More... | |
| const_iterator | find (const T &x, const_iterator first, const_iterator last) const |
| Find element x in the array range specified by the first and last iterators. More... | |
| const_iterator | find (const T &x) const |
| Find element x in the array. More... | |
| iterator | find (const T &x, iterator first, iterator last) |
| Find element x in the array range specified by the first and last iterators. More... | |
| iterator | find (const T &x) |
| Find element x in the array. More... | |
| bool | contains (const T &x, const_iterator first, const_iterator last) const |
| Determine if element x is contained in the array range specified by the first and last iterators. More... | |
| bool | contains (const T &x) const |
| Determine if element x is contained in the array. More... | |
Private Types | |
| typedef std::vector< T, std::allocator< T > > | V |
Private Attributes | |
| COWReference< V > | m_impl |
Friends | |
| bool | operator== (const Array< T > &x, const Array< T > &y) |
| Determine equality of two Arrays. More... | |
| bool | operator< (const Array< T > &x, const Array< T > &y) |
| Determine if one Array is less than another. More... | |
Array<> wraps std::vector<> in COWReference<> adding ref counting and copy on write capability.
It also adds valid range checks to operator[] if BLOCXX_CHECK_ARRAY_INDEXING is defined.
Invariants: See std::vector<> Thread safety: read Copy semantics: Copy On Write Exception safety: same as std::vector<T>
| typedef V::const_iterator BLOCXX_NAMESPACE::Array< T >::const_iterator |
| typedef V::const_pointer BLOCXX_NAMESPACE::Array< T >::const_pointer |
| typedef V::const_reference BLOCXX_NAMESPACE::Array< T >::const_reference |
| typedef V::const_reverse_iterator BLOCXX_NAMESPACE::Array< T >::const_reverse_iterator |
| typedef V::difference_type BLOCXX_NAMESPACE::Array< T >::difference_type |
| typedef V::iterator BLOCXX_NAMESPACE::Array< T >::iterator |
| typedef V::pointer BLOCXX_NAMESPACE::Array< T >::pointer |
| typedef V::reference BLOCXX_NAMESPACE::Array< T >::reference |
| typedef V::reverse_iterator BLOCXX_NAMESPACE::Array< T >::reverse_iterator |
| typedef V::size_type BLOCXX_NAMESPACE::Array< T >::size_type |
|
private |
| typedef V::value_type BLOCXX_NAMESPACE::Array< T >::value_type |
|
inline |
Default Constructor.
Definition at line 85 of file ArrayImpl.hpp.
|
inline |
Destructor.
Definition at line 91 of file ArrayImpl.hpp.
|
inlineexplicit |
Constructor.
| toWrap | The std::vector to wrap with this Array object. |
Definition at line 96 of file ArrayImpl.hpp.
|
inline |
Construct an Array that consist of a specified number of elements that are copies of a given object.
| n | Number of elements the Array will contain. |
| value | The value every element of the array will be initialized to. |
Definition at line 102 of file ArrayImpl.hpp.
References m_impl.
|
inline |
Construct an Array that consist of a specified number of elements that are copies of a given object.
| n | Number of elements the Array will contain. |
| value | The value every element of the array will be initialized to. |
Definition at line 108 of file ArrayImpl.hpp.
|
inline |
Construct an Array that consist of a specified number of elements that are copies of a given object.
| n | Number of elements the Array will contain. |
| value | The value every element of the array will be initialized to. |
Definition at line 114 of file ArrayImpl.hpp.
|
inlineexplicit |
Construct an Array that consist of a specified number of elements that have be constructed using the default constructor of class T.
| n | Number of elements the Array will contain. |
Definition at line 120 of file ArrayImpl.hpp.
|
inline |
Construct an Array from a range specified with InputIterators.
| first | The iterator for the beginning of the range. |
| last | The iterator for the end of the range. |
Definition at line 127 of file ArrayImpl.hpp.
|
inline |
Append an element to the end of the Array.
This is identical to push_back.
| x | The element to append to the end of the Array. |
Definition at line 288 of file ArrayImpl.hpp.
Referenced by BLOCXX_NAMESPACE::FileSystem::getDirectoryContents(), and BLOCXX_NAMESPACE::String::tokenize().
|
inline |
Append the elements of another Array to the end of this Array.
| x | The Array the elements will be copied from. |
Definition at line 345 of file ArrayImpl.hpp.
|
inline |
Definition at line 267 of file ArrayImpl.hpp.
|
inline |
Definition at line 274 of file ArrayImpl.hpp.
|
inline |
Definition at line 134 of file ArrayImpl.hpp.
Referenced by BLOCXX_NAMESPACE::Cstr::CstrArr< SA >::CstrArr(), BLOCXX_NAMESPACE::DateTime::DateTime(), and BLOCXX_NAMESPACE::Array< T >::remove().
|
inline |
Definition at line 141 of file ArrayImpl.hpp.
|
inline |
Definition at line 204 of file ArrayImpl.hpp.
|
inline |
Remove all items from the Array.
The size() of the Array should be zero after calling this method.
Definition at line 387 of file ArrayImpl.hpp.
Referenced by BLOCXX_NAMESPACE::FileSystem::getDirectoryContents().
|
inline |
Determine if element x is contained in the array.
| x | The element to seach for. |
Definition at line 443 of file ArrayImpl.hpp.
References BLOCXX_NAMESPACE::Array< T >::swap().
|
inline |
Determine if element x is contained in the array range specified by the first and last iterators.
| x | The element to seach for. |
| first | The first position iterator; begin of the range. |
| last | The last position iterator; end of the range. |
Definition at line 436 of file ArrayImpl.hpp.
|
inline |
Definition at line 211 of file ArrayImpl.hpp.
Referenced by BLOCXX_NAMESPACE::UTF8Utils::StringToUCS2().
|
inline |
Definition at line 148 of file ArrayImpl.hpp.
Referenced by BLOCXX_NAMESPACE::Cstr::CstrArr< SA >::CstrArr(), BLOCXX_NAMESPACE::DateTime::DateTime(), and BLOCXX_NAMESPACE::Array< T >::remove().
|
inline |
Definition at line 155 of file ArrayImpl.hpp.
|
inline |
Remove elements of the Array specified by a beginning and ending iterator.
| first | An iterator that specifies the first element to remove. |
| last | An iterator that specifies the last element to remove. |
Definition at line 366 of file ArrayImpl.hpp.
|
inline |
Remove an element of the Array specified with an iterator.
| position | An iterator that points to the element to be removed. |
Definition at line 359 of file ArrayImpl.hpp.
|
inline |
Find element x in the array.
| x | The element to seach for. |
Definition at line 429 of file ArrayImpl.hpp.
|
inline |
Find element x in the array.
| x | The element to seach for. |
Definition at line 408 of file ArrayImpl.hpp.
|
inline |
Find element x in the array range specified by the first and last iterators.
| x | The element to seach for. |
| first | The first position iterator; begin of the range. |
| last | The last position iterator; end of the range. |
Definition at line 394 of file ArrayImpl.hpp.
|
inline |
Find element x in the array range specified by the first and last iterators.
| x | The element to seach for. |
| first | The first position iterator; begin of the range. |
| last | The last position iterator; end of the range. |
Definition at line 415 of file ArrayImpl.hpp.
|
inline |
Definition at line 253 of file ArrayImpl.hpp.
|
inline |
Definition at line 260 of file ArrayImpl.hpp.
|
inline |
Insert an element in the Array before an element specified by an iterator.
| position | An iterator that points to the insertion point. The element will be inserted before this point. |
| x | The element to insert into the Array. |
Definition at line 302 of file ArrayImpl.hpp.
|
inline |
Insert a range of elements before a given position in the Array.
| position | The position to insert the elements at. The insertion will be done before this position. |
| first | The beginning of the range of elements to insert. |
| last | The end of the range of elements to insert. |
Definition at line 338 of file ArrayImpl.hpp.
|
inline |
Insert an element in the Array before an element specified by an index.
| position | An index that specifies where the element will be inserted. |
| x | The element to insert into the Array. |
Definition at line 309 of file ArrayImpl.hpp.
References m_impl.
|
inline |
Definition at line 197 of file ArrayImpl.hpp.
|
inline |
|
inline |
Retrieve A read/write reference to an object in the Array at a given index.
| n | The index of the element to retrieve the reference for. |
Definition at line 218 of file ArrayImpl.hpp.
|
inline |
Retrieve A read only reference to an object in the Array at a given index.
| n | The index of the element to retrieve the reference for. |
Definition at line 228 of file ArrayImpl.hpp.
|
inline |
Remove the last element of the Array.
Definition at line 352 of file ArrayImpl.hpp.
|
inline |
Append an element to the end of the Array.
| x | The element to append to the end of the Array. |
Definition at line 281 of file ArrayImpl.hpp.
Referenced by BLOCXX_NAMESPACE::Exec::processInputOutput().
|
inline |
Definition at line 162 of file ArrayImpl.hpp.
|
inline |
Definition at line 169 of file ArrayImpl.hpp.
|
inline |
Remove an element specified by a range.
| begin | An iterator that specifies the beginning of the range to remove. |
| end | An iterator that specifies the end of the range to remove. |
Definition at line 326 of file ArrayImpl.hpp.
|
inline |
Remove an element from the Array at a given index.
Definition at line 316 of file ArrayImpl.hpp.
References BLOCXX_NAMESPACE::Array< T >::begin(), and BLOCXX_NAMESPACE::Array< T >::end().
|
inline |
Definition at line 176 of file ArrayImpl.hpp.
|
inline |
Definition at line 183 of file ArrayImpl.hpp.
|
inline |
Ensure the capacity is at least the size of a given value.
If the given value is > max_size() the method with throw an std::length_error exception.
| n | - The minimum size this Array can be. |
Definition at line 246 of file ArrayImpl.hpp.
|
inline |
Ensure the Array is a given size.
If the Array needs to be larger that what it already is, this method will append items that have been initialized using the default constructor of class T.
| new_size | The new size of the Array. |
Definition at line 380 of file ArrayImpl.hpp.
|
inline |
Ensure the Array is a given size.
| new_size | The new size of the Array. |
| x | An object to append to the end of the Array if it needs to be larger than what it already is. |
Definition at line 373 of file ArrayImpl.hpp.
|
inline |
Definition at line 190 of file ArrayImpl.hpp.
Referenced by BLOCXX_NAMESPACE::AppenderLogger::AppenderLogger(), BLOCXX_NAMESPACE::DateTime::DateTime(), BLOCXX_NAMESPACE::Exec::processInputOutput(), and BLOCXX_NAMESPACE::String::String().
|
inline |
Swap the elements of this Array with the elements of another.
Definition at line 295 of file ArrayImpl.hpp.
Referenced by BLOCXX_NAMESPACE::Array< T >::contains().
Determine if one Array is less than another.
This is done by doing a lexicographical compare on the Arrays. a lexicographical compare will compares the Arrays element by element until:
Definition at line 469 of file ArrayImpl.hpp.
Determine equality of two Arrays.
Two Arrays are considered equal if they are of the same size and elements in the same position are equal as defined by the “==” operator of the type in the Array.
Definition at line 464 of file ArrayImpl.hpp.
|
private |
1.8.18