#include <mfcstl/collections/carray_adaptors.hpp>
A | The array class, e.g. CObArray, CArray<long>, etc. | |
I | The interface specialisation, e.g. CArray_cadaptor<CObArray>, CArray_iadaptor<CArray<long> >, etc. | |
T | The traits class, e.g. CArray_traits<CObArray> |
Member Constants | |
enum | { growthGranularity = 16 } |
static size_type | calc_increment_ (size_type n) |
Member Types | |
typedef A | array_type |
The type of the underlying MFC array. | |
typedef array_traits_type::value_type | value_type |
The value type. | |
typedef afx_allocator< value_type > | allocator_type |
The allocator type. | |
typedef allocator_type::reference | reference |
The mutating (non-const) reference type. | |
typedef allocator_type::const_reference | const_reference |
The non-mutating (const) reference type. | |
typedef allocator_type::pointer | pointer |
The mutating (non-const) pointer type. | |
typedef allocator_type::const_pointer | const_pointer |
The non-mutating (const) pointer type. | |
typedef pointer_iterator < value_type, pointer, reference >::type | iterator |
The mutating (non-const) iterator type. | |
typedef pointer_iterator < value_type const , const_pointer, const_reference >::type | const_iterator |
The non-mutating (const) iterator type. | |
typedef size_t | size_type |
The size type. | |
typedef ms_ptrdiff_t | difference_type |
The difference type. | |
typedef CArray_adaptor_base< A, I, T > | class_type |
The instantiation of the current type. | |
Implementation | |
template<typename I2> | |
static bool | is_valid_source_range_ (I2 first, I2 last, std::input_iterator_tag) |
template<typename I2, typename T2> | |
static bool | is_valid_source_range_ (I2 first, I2 last, T2) |
template<typename I2> | |
static bool | is_valid_source_range_ (I2 first, I2 last, std::random_access_iterator_tag) |
template<typename I2> | |
static bool | is_valid_source_range_ (I2 first, I2 last) |
Construction | |
allocator_type | get_allocator () const |
Returns a copy of the allocator used by the container. | |
CArray_adaptor_base () | |
Default constructor. | |
~CArray_adaptor_base () throw () | |
Destructor. | |
size_type | grow_increment () const |
size_type | capacity () const |
Public Member Functions | |
Underlying Container Access | |
array_type & | get_CArray () |
Returns a mutating (non-const) reference to the underlying array. | |
array_type const & | get_CArray () const |
Returns a non-mutating (const) reference to the underlying array. | |
Assignment | |
void | assign (size_type n, value_type const &value) |
Assigns a number of copies of the given value to the array, erasing all prior content. | |
template<typename I2> | |
void | assign (I2 first, I2 last) |
Assigns each element in the range [first, last) to the array, erasing all prior content. | |
Size and Capacity | |
size_type | size () const |
The number of items in the array. | |
size_type | max_size () const |
The maximum number of items that can be stored in the array. | |
bool | empty () const |
Indicates whether the array is empty. | |
void | resize (size_type n) |
Adjusts the number of elements in the array. | |
void | resize (size_type n, value_type value) |
Adjusts the number of elements in the array. | |
Element access | |
reference | operator[] (size_type n) |
Returns a mutable (non-const) reference to the element at the given index. | |
const_reference | operator[] (size_type n) const |
Returns a non-mutable (const) reference to the element at the given index. | |
reference | at (size_type n) |
Returns a mutable (non-const) reference to the element at the given index. | |
const_reference | at (size_type n) const |
Returns a non-mutable (const) reference to the element at the given index. | |
reference | front () |
Returns a mutable (non-const) reference to the first element in the array. | |
reference | back () |
Returns a mutable (non-const) reference to the last element in the array. | |
const_reference | front () const |
Returns a non-mutable (const) reference to the first element in the array. | |
const_reference | back () const |
Returns a non-mutable (const) reference to the last element in the array. | |
Iteration | |
iterator | begin () |
Returns a mutable (non-const) iterator representing the start of the array. | |
iterator | end () |
Returns a mutable (non-const) iterator representing the end of the array. | |
const_iterator | begin () const |
Returns a non-mutable (const) iterator representing the start of the array. | |
const_iterator | end () const |
Returns a non-mutable (const) iterator representing the end of the array. | |
Comparison | |
template<typename A2, typename I2, typename T2> | |
bool | equal (CArray_adaptor_base< A2, I2, T2 > const &rhs) const |
bool | equal (array_type const &rhs) const |
template<typename A2, typename I2, typename T2> | |
bool | less_than (CArray_adaptor_base< A2, I2, T2 > const &rhs) const |
bool | less_than (array_type const &rhs) const |
template<typename A2, typename I2, typename T2> | |
bool | greater_than (CArray_adaptor_base< A2, I2, T2 > const &rhs) const |
bool | greater_than (array_type const &rhs) const |
Modifiers | |
void | push_back (value_type const &value) |
Adds the given element to the end of the array. | |
void | pop_back () throw () |
Removes the last element from the non-empty array. | |
iterator | insert (iterator pos, value_type const &value) |
Inserts the given value at the given position. | |
void | insert (iterator pos, size_type n, value_type const &value) |
Inserts a number of copies of the given value at the given position. | |
template<typename I2> | |
void | insert (iterator pos, I2 first, I2 last) |
Inserts the elements in the range [first, last) at the given position. | |
iterator | erase (iterator pos) throw () |
Erases the element at the given position. | |
iterator | erase (iterator first, iterator last) throw () |
Erases a range of elements from the array. | |
void | clear () throw () |
Removes all the elements from the array. | |
void | swap_by_copy (class_type &rhs) |
Exchanges the contents with those of another array by copying each of the constituents, using a temporary array instance. |
typedef A array_type |
typedef array_traits_type::value_type value_type |
The value type.
Reimplemented in CArray_cadaptor, and CArray_iadaptor.
typedef afx_allocator<value_type> allocator_type |
typedef allocator_type::reference reference |
typedef allocator_type::pointer pointer |
typedef pointer_iterator< value_type , pointer , reference >::type iterator |
typedef pointer_iterator< value_type const , const_pointer , const_reference >::type const_iterator |
typedef size_t size_type |
typedef ms_ptrdiff_t difference_type |
typedef CArray_adaptor_base<A, I, T> class_type |
CArray_adaptor_base | ( | ) | [inline, protected] |
Default constructor.
This is protected, because CArray_adaptor_base serves as an abstract base for CArray_cadaptor and CArray_iadaptor
~CArray_adaptor_base | ( | ) | throw () [inline, protected] |
Destructor.
array_type& get_CArray | ( | ) | [inline] |
Returns a mutating (non-const) reference to the underlying array.
array_type const& get_CArray | ( | ) | const [inline] |
Returns a non-mutating (const) reference to the underlying array.
allocator_type get_allocator | ( | ) | const [inline] |
Returns a copy of the allocator used by the container.
void assign | ( | size_type | n, | |
value_type const & | value | |||
) | [inline] |
Assigns a number of copies of the given value to the array, erasing all prior content.
n | The number of values to assign | |
value | The value of which n copies are to be assigned |
The elements are default constructed, and then copy-assigned
void assign | ( | I2 | first, | |
I2 | last | |||
) | [inline] |
Assigns each element in the range [first, last) to the array, erasing all prior content.
first | The first element in the range | |
last | The (one past the) last element in the range |
The elements are default constructed, and then copy-assigned
size_type size | ( | ) | const [inline] |
The number of items in the array.
size_type max_size | ( | ) | const [inline] |
The maximum number of items that can be stored in the array.
bool empty | ( | ) | const [inline] |
Indicates whether the array is empty.
void resize | ( | size_type | n | ) | [inline] |
Adjusts the number of elements in the array.
n | The number of elements that the array will contain after resizing |
void resize | ( | size_type | n, | |
value_type | value | |||
) | [inline] |
Adjusts the number of elements in the array.
n | The number of elements that the array will contain after resizing | |
value | The value of any additional elements created during resizing |
Exception-safety is weak, but the size is maintained in the case where an exception is thrown by the copy assignment of any new elements.
Returns a mutable (non-const) reference to the element at the given index.
n | The requested index. Must be less than size() |
const_reference operator[] | ( | size_type | n | ) | const [inline] |
Returns a non-mutable (const) reference to the element at the given index.
n | The requested index. Must be less than size() |
Returns a mutable (non-const) reference to the element at the given index.
n | The requested index. If the index is not less than size() an instance of std::out_of_range will be thrown |
const_reference at | ( | size_type | n | ) | const [inline] |
Returns a non-mutable (const) reference to the element at the given index.
n | The requested index. If the index is not less than size() an instance of std::out_of_range will be thrown |
reference front | ( | ) | [inline] |
Returns a mutable (non-const) reference to the first element in the array.
reference back | ( | ) | [inline] |
Returns a mutable (non-const) reference to the last element in the array.
const_reference front | ( | ) | const [inline] |
Returns a non-mutable (const) reference to the first element in the array.
const_reference back | ( | ) | const [inline] |
Returns a non-mutable (const) reference to the last element in the array.
iterator begin | ( | ) | [inline] |
Returns a mutable (non-const) iterator representing the start of the array.
Referenced by CArray_cadaptor::CArray_cadaptor().
iterator end | ( | ) | [inline] |
Returns a mutable (non-const) iterator representing the end of the array.
Referenced by CArray_cadaptor::CArray_cadaptor().
const_iterator begin | ( | ) | const [inline] |
Returns a non-mutable (const) iterator representing the start of the array.
const_iterator end | ( | ) | const [inline] |
Returns a non-mutable (const) iterator representing the end of the array.
void push_back | ( | value_type const & | value | ) | [inline] |
Adds the given element to the end of the array.
value | The value to add to the end of the array |
void pop_back | ( | ) | throw () [inline] |
Removes the last element from the non-empty array.
iterator insert | ( | iterator | pos, | |
value_type const & | value | |||
) | [inline] |
Inserts the given value at the given position.
pos | The position at which to insert. The value will be inserted before the element referred to by pos, or at the end if pos == end() | |
value | The value to be inserted |
The | position of the inserted value |
Any elements after the insertion position are moved using memmove, rather than by copy construction. If the element type maintains pointers to its internal members, or to its peer elements, then these relationships will be broken, and the subsequent behaviour of the program will be undefined
void insert | ( | iterator | pos, | |
size_type | n, | |||
value_type const & | value | |||
) | [inline] |
Inserts a number of copies of the given value at the given position.
pos | The position at which to insert. The value(s) will be inserted before the element referred to by pos, or at the end if pos == end() | |
n | The number of values to insert | |
value | The value to be inserted |
Any elements after the insertion position are moved using memmove, rather than by copy construction. If the element type maintains pointers to its internal members, or to its peer elements, then these relationships will be broked, and the subsequent behaviour of the program will be undefined
void insert | ( | iterator | pos, | |
I2 | first, | |||
I2 | last | |||
) | [inline] |
Inserts the elements in the range [first, last) at the given position.
pos | The position at which to insert. The value(s) will be inserted before the element referred to by pos, or at the end if pos == end() | |
first | The start of the range of values to insert | |
last | The (one past the) end of the range of values to insert |
Any elements after the insertion position are moved using memmove, rather than by copy construction. If the element type maintains pointers to its internal members, or to its peer elements, then these relationships will be broked, and the subsequent behaviour of the program will be undefined
Erases the element at the given position.
pos | The position of the element to be removed |
The | position of the value immediately following the element erased |
pos
will be invalidated. Those before pos
remain validAny elements after the erasure position are moved using memmove, rather than by copy construction. If the element type maintains pointers to its internal members, or to its peer elements, then these relationships will be broked, and the subsequent behaviour of the program will be undefined
Erases a range of elements from the array.
first | The first element in the range to be removed | |
last | The (one past the) end element in the range to be removed |
The | position of the value immediately following the elements erased |
first
will be invalidated. Those before first
remain validAny elements after the erasure position are moved using memmove, rather than by copy construction. If the element type maintains pointers to its internal members, or to its peer elements, then these relationships will be broked, and the subsequent behaviour of the program will be undefined
void clear | ( | ) | throw () [inline] |
Removes all the elements from the array.
void swap_by_copy | ( | class_type & | rhs | ) | [inline] |
Exchanges the contents with those of another array by copying each of the constituents, using a temporary array instance.
rhs | The instance whose contents will be exchanged with the callee |