mdds
|
#include <multi_type_vector.hpp>
Public Types | |
typedef size_t | size_type |
typedef mdds::mtv::base_element_block | element_block_type |
typedef mdds::mtv::element_t | element_category_type |
typedef _ElemBlockFunc | element_block_func |
typedef _EventFunc | event_func |
typedef detail::mtv::iterator_base< iterator_trait, itr_forward_update > | iterator |
typedef detail::mtv::iterator_base< reverse_iterator_trait, itr_no_update > | reverse_iterator |
typedef detail::mtv::const_iterator_base< const_iterator_trait, itr_forward_update, iterator > | const_iterator |
typedef detail::mtv::const_iterator_base< const_reverse_iterator_trait, itr_no_update, reverse_iterator > | const_reverse_iterator |
typedef itr_node | value_type |
typedef std::pair< iterator, size_type > | position_type |
typedef std::pair< const_iterator, size_type > | const_position_type |
Public Member Functions | |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
const_iterator | cbegin () const |
const_iterator | cend () const |
reverse_iterator | rbegin () |
reverse_iterator | rend () |
const_reverse_iterator | rbegin () const |
const_reverse_iterator | rend () const |
const_reverse_iterator | crbegin () const |
const_reverse_iterator | crend () const |
event_func & | event_handler () |
const event_func & | event_handler () const |
multi_type_vector () | |
multi_type_vector (const event_func &hdl) | |
multi_type_vector (event_func &&hdl) | |
multi_type_vector (size_type init_size) | |
template<typename _T > | |
multi_type_vector (size_type init_size, const _T &value) | |
template<typename _T > | |
multi_type_vector (size_type init_size, const _T &it_begin, const _T &it_end) | |
multi_type_vector (const multi_type_vector &other) | |
~multi_type_vector () | |
template<typename _T > | |
iterator | set (size_type pos, const _T &value) |
template<typename _T > | |
iterator | set (const iterator &pos_hint, size_type pos, const _T &value) |
template<typename _T > | |
iterator | set (size_type pos, const _T &it_begin, const _T &it_end) |
template<typename _T > | |
iterator | set (const iterator &pos_hint, size_type pos, const _T &it_begin, const _T &it_end) |
template<typename _T > | |
iterator | push_back (const _T &value) |
iterator | push_back_empty () |
template<typename _T > | |
iterator | insert (size_type pos, const _T &it_begin, const _T &it_end) |
template<typename _T > | |
iterator | insert (const iterator &pos_hint, size_type pos, const _T &it_begin, const _T &it_end) |
template<typename _T > | |
void | get (size_type pos, _T &value) const |
template<typename _T > | |
_T | get (size_type pos) const |
template<typename _T > | |
_T | release (size_type pos) |
template<typename _T > | |
iterator | release (size_type pos, _T &value) |
template<typename _T > | |
iterator | release (const iterator &pos_hint, size_type pos, _T &value) |
void | release () |
iterator | release_range (size_type start_pos, size_type end_pos) |
iterator | release_range (const iterator &pos_hint, size_type start_pos, size_type end_pos) |
position_type | position (size_type pos) |
position_type | position (const iterator &pos_hint, size_type pos) |
const_position_type | position (size_type pos) const |
const_position_type | position (const const_iterator &pos_hint, size_type pos) const |
iterator | transfer (size_type start_pos, size_type end_pos, multi_type_vector &dest, size_type dest_pos) |
iterator | transfer (const iterator &pos_hint, size_type start_pos, size_type end_pos, multi_type_vector &dest, size_type dest_pos) |
mtv::element_t | get_type (size_type pos) const |
bool | is_empty (size_type pos) const |
iterator | set_empty (size_type start_pos, size_type end_pos) |
iterator | set_empty (const iterator &pos_hint, size_type start_pos, size_type end_pos) |
void | erase (size_type start_pos, size_type end_pos) |
iterator | insert_empty (size_type pos, size_type length) |
iterator | insert_empty (const iterator &pos_hint, size_type pos, size_type length) |
void | clear () |
size_type | size () const |
size_type | block_size () const |
bool | empty () const |
void | resize (size_type new_size) |
void | swap (multi_type_vector &other) |
void | swap (size_type start_pos, size_type end_pos, multi_type_vector &other, size_type other_pos) |
void | shrink_to_fit () |
bool | operator== (const multi_type_vector &other) const |
bool | operator!= (const multi_type_vector &other) const |
multi_type_vector & | operator= (const multi_type_vector &other) |
Static Public Member Functions | |
static position_type | next_position (const position_type &pos) |
static position_type | advance_position (const position_type &pos, int steps) |
static const_position_type | next_position (const const_position_type &pos) |
static const_position_type | advance_position (const const_position_type &pos, int steps) |
static size_type | logical_position (const const_position_type &pos) |
template<typename _Blk > | |
static _Blk::value_type | get (const const_position_type &pos) |
template<typename _T > | |
static mtv::element_t | get_element_type (const _T &elem) |
Multi-type vector consists of a series of one or more blocks, and each block may either be empty, or stores a series of non-empty elements of identical type. These blocks collectively represent a single logical one-dimensional array that may store elements of different types. It is guaranteed that the block types of neighboring blocks are always different.
Structurally, the primary array stores block instances whose types are of value_type
, which in turn consists of the following data members:
type
which indicates the block type, position
which stores the logical position of the first element of the block, size
which stores the logical size of the block, and data
which stores the pointer to a secondary array (a.k.a. element block) which stores the actual element values, or nullptr
in case the block represents an empty segment. typedef _EventFunc mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::event_func |
Optional event handler function structure, whose functions get called at specific events. The following events are currently supported:
element_block_acquired
- this gets called whenever the container acquires a new element block either as a result of a new element block creation or a tranfer of an existing element block from another container. element_block_released
- this gets called whenever the container releases an existing element block either because the block gets deleted or gets transferred to another container. typedef itr_node mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::value_type |
value_type is the type of a block stored in the primary array. It consists of the following data members:
type
which indicates the block type, position
which stores the logical position of the first element of the block, size
which stores the logical size of the block, and data
which stores the pointer to a secondary array (a.k.a. element block) which stores the actual element values, or nullptr
in case the block represents an empty segment. mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::multi_type_vector | ( | ) |
Default constructor. It initializes the container with empty size.
mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::multi_type_vector | ( | const event_func & | hdl | ) |
Constructor that takes an lvalue reference to an event handler object. The event handler instance will be copy-constructed.
hdl | lvalue reference to an event handler object. |
mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::multi_type_vector | ( | event_func && | hdl | ) |
Constructor that takes an rvalue reference to an event handler object. The event handler instance will be move-constructed.
hdl | rvalue reference to an event handler object. |
mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::multi_type_vector | ( | size_type | init_size | ) |
Constructor that takes initial size of the container. When the size specified is greater than 0, it initializes the container with empty elements.
init_size | initial container size. |
mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::multi_type_vector | ( | size_type | init_size, |
const _T & | value | ||
) |
Constructor that takes initial size of the container and an element value to initialize the elements to. When the size specified is greater than 0, it initializes the container with elements that are copies of the value specified.
init_size | initial container size. |
value | initial element value. |
mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::multi_type_vector | ( | size_type | init_size, |
const _T & | it_begin, | ||
const _T & | it_end | ||
) |
Constructor that takes initial size of the container and begin and end iterator positions that specify a series of elements to initialize the container to. The container will contain copies of the elements specified after this call returns.
init_size | initial container size. |
it_begin | iterator that points to the begin position of the values the container is being initialized to. |
it_end | iterator that points to the end position of the values the container is being initialized to. The end position is not inclusive. |
mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::multi_type_vector | ( | const multi_type_vector< _ElemBlockFunc, _EventFunc > & | other | ) |
Copy constructor.
other | other column instance to copy values from. |
mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::~multi_type_vector | ( | ) |
Destructor. It deletes all allocated data blocks.
|
static |
Increment or decrement the position object by specified steps. Caller must ensure the the position object is valid.
pos | position object. |
steps | steps to advance the position object. |
|
static |
Increment or decrement the position object by specified steps. Caller must ensure the the position object is valid.
pos | position object. |
steps | steps to advance the position object. |
size_type mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::block_size | ( | ) | const |
Return the current number of blocks in the primary array. Each non-empty block stores a secondary block that stores elements in a contiguous region in memory (element block) and the number of elements it stores. An empty block only stores its logical size and does not store an actual element block.
For instance, if the container stores values of double-precision type at rows 0 to 2, values of std::string type at 3 to 7, and empty values at 8 to 10, it would consist of three blocks: one that stores double values, one that stores std::string values, and one that represents the empty value range in this exact order. In this specific scenario, block_size()
returns 3, and size()
returns 11.
void mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::clear | ( | ) |
Clear the content of the container. The size of the container will become zero after calling this method.
bool mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::empty | ( | ) | const |
Return whether or not the container is empty.
void mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::erase | ( | size_type | start_pos, |
size_type | end_pos | ||
) |
Erase elements located between specified start and end positions. The end positions are both inclusive. Those elements originally located after the specified end position will get shifted up after the erasure.
The method will throw an std::out_of_range
exception if either the starting or the ending position is outside the current container range.
Calling this method will decrease the size of the container by the length of the erased range.
start_pos | starting position |
end_pos | ending position, inclusive. |
|
static |
Get element value from a position object. The caller must specify the type of block in which the element is expected to be stored.
pos | position object. |
void mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::get | ( | size_type | pos, |
_T & | value | ||
) | const |
Get the value of an element at specified position. The caller must pass a variable of the correct type to store the value.
The method will throw an std::out_of_range
exception if the specified position is outside the current container range.
pos | position of the element value to retrieve. |
value | (out) variable to store the retrieved value. |
_T mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::get | ( | size_type | pos | ) | const |
Get the value of an element at specified position. The caller must specify the type of the element as the template parameter e.g. get<double>(1).
The method will throw an std::out_of_range
exception if the specified position is outside the current container range.
pos | position of the element value to retrieve. |
|
static |
Return the numerical identifier that represents passed element.
elem | element value. |
mtv::element_t mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::get_type | ( | size_type | pos | ) | const |
Get the type of an element at specified position.
pos | position of the element. |
iterator mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::insert | ( | size_type | pos, |
const _T & | it_begin, | ||
const _T & | it_end | ||
) |
Insert multiple values of identical type to a specified position. Existing values that occur at or below the specified position will get shifted after the insertion. No existing values will be overwritten by the inserted values.
The method will throw an std::out_of_range
exception if the specified position is outside the current container range.
Calling this method will increase the size of the container by the length of the new values inserted.
pos | position at which the new values are to be inserted. |
it_begin | iterator that points to the begin position of the values being inserted. |
it_end | iterator that points to the end position of the values being inserted. |
iterator mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::insert | ( | const iterator & | pos_hint, |
size_type | pos, | ||
const _T & | it_begin, | ||
const _T & | it_end | ||
) |
Insert multiple values of identical type to a specified position. Existing values that occur at or below the specified position will get shifted after the insertion. No existing values will be overwritten by the inserted values.
This variant takes an iterator as an additional parameter, which is used as a block position hint to speed up the lookup of the first insertion block. The other variant that doesn't take an iterator always starts the block lookup from the first block, which does not scale well as the block size grows.
This position hint iterator must precede the insertion position to yield any performance benefit.
The caller is responsible for ensuring that the passed iterator is valid. The behavior of this method when passing an invalid iterator is undefined.
The method will throw an std::out_of_range
exception if the specified position is outside the current container range.
Calling this method will increase the size of the container by the length of the new values inserted.
pos_hint | iterator used as a block position hint, to specify which block to start when searching for the right block to insert the value into. |
pos | position at which the new values are to be inserted. |
it_begin | iterator that points to the begin position of the values being inserted. |
it_end | iterator that points to the end position of the values being inserted. |
iterator mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::insert_empty | ( | size_type | pos, |
size_type | length | ||
) |
Insert a range of empty elements at specified position. Those elements originally located after the insertion position will get shifted down after the insertion.
The method will throw an std::out_of_range
exception if either the specified position is outside the current container range.
Calling this method will increase the size of the container by the length of the inserted empty elements.
pos | position at which to insert a range of empty elements. |
length | number of empty elements to insert. |
iterator mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::insert_empty | ( | const iterator & | pos_hint, |
size_type | pos, | ||
size_type | length | ||
) |
Insert a range of empty elements at specified position. Those elements originally located after the insertion position will get shifted down after the insertion.
This variant takes an iterator as an additional parameter, which is used as a block position hint to speed up the lookup of the block in which to insert the new empty segment. The other variant that doesn't take an iterator always starts the block lookup from the first block, which does not scale well as the block size grows.
This position hint iterator must precede the start position to yield any performance benefit.
The caller is responsible for ensuring that the passed iterator is valid. The behavior of this method when passing an invalid iterator is undefined.
The method will throw an std::out_of_range
exception if either the specified position is outside the current container range.
Calling this method will increase the size of the container by the length of the inserted empty elements.
pos_hint | iterator used as a block position hint, to specify which block to start when searching for the right block in which to insert the empty segment. |
pos | position at which to insert a range of empty elements. |
length | number of empty elements to insert. |
bool mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::is_empty | ( | size_type | pos | ) | const |
Check if element at specified position is empty of not.
The method will throw an std::out_of_range
exception if the specified position is outside the current container range.
pos | position of the element to check. |
|
static |
Extract the logical position from a position object.
pos | position object. |
|
static |
Move the position object to the next logical position. Caller must ensure the the position object is valid.
pos | position object. |
|
static |
Move the position object to the next logical position. Caller must ensure the the position object is valid.
pos | position object. |
position_type mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::position | ( | size_type | pos | ) |
Given the logical position of an element, get the iterator of the block where the element is located, and its offset from the first element of that block.
The method will throw an std::out_of_range
exception if the specified position is outside the current container range, except when the specified position is the position immediately after the last valid position, it will return a valid position object representing the end position.
pos | logical position of the element. |
position_type mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::position | ( | const iterator & | pos_hint, |
size_type | pos | ||
) |
Given the logical position of an element, get the iterator of the block where the element is located, and its offset from the first element of that block.
The method will throw an std::out_of_range
exception if the specified position is outside the current container range, except when the specified position is the position immediately after the last valid position, it will return a valid position object representing the end position.
pos_hint | iterator used as a block position hint, to specify which block to start when searching for the element position. |
pos | logical position of the element. |
const_position_type mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::position | ( | size_type | pos | ) | const |
Given the logical position of an element, get an iterator referencing the element block where the element is located, and its offset from the first element of that block.
The method will throw an std::out_of_range
exception if the specified position is outside the current container range.
pos | position of the element. |
const_position_type mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::position | ( | const const_iterator & | pos_hint, |
size_type | pos | ||
) | const |
Given the logical position of an element, get an iterator referencing the element block where the element is located, and its offset from the first element of that block.
The method will throw an std::out_of_range
exception if the specified position is outside the current container range.
pos_hint | iterator used as a block position hint, to specify which block to start when searching for the element position. |
pos | logical position of the element. |
iterator mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::push_back | ( | const _T & | value | ) |
Append a new value to the end of the container.
value | new value to be appended to the end of the container. |
iterator mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::push_back_empty | ( | ) |
Append a new empty element to the end of the container.
_T mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::release | ( | size_type | pos | ) |
Return the value of an element at specified position and set that position empty. If the element resides in a managed element block, this call will release that element from that block. If the element is on a non-managed element block, this call is equivalent to set_empty(pos, pos).
The method will throw an std::out_of_range
exception if the specified position is outside the current container range.
pos | position of the element to release. |
iterator mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::release | ( | size_type | pos, |
_T & | value | ||
) |
Retrieve the value of an element at specified position and set that position empty. If the element resides in a managed element block, this call will release that element from that block. If the element is on a non-managed element block, this call is equivalent to set_empty(pos, pos).
The method will throw an std::out_of_range
exception if the specified position is outside the current container range.
pos | position of the element to release. |
value | element value. |
iterator mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::release | ( | const iterator & | pos_hint, |
size_type | pos, | ||
_T & | value | ||
) |
Retrieve the value of an element at specified position and set that position empty. If the element resides in a managed element block, this call will release that element from that block. If the element is on a non-managed element block, this call is equivalent to set_empty(pos, pos).
The method will throw an std::out_of_range
exception if the specified position is outside the current container range.
pos | position of the element to release. |
value | element value. |
void mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::release | ( | ) |
Release all its elements, and empties its content. Calling this method relinquishes the ownership of all elements stored in managed element blocks if any.
This call is equivalent of clear() if the container consists of no managed element blocks.
iterator mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::release_range | ( | size_type | start_pos, |
size_type | end_pos | ||
) |
Make all elements within specified range empty, and relinquish the ownership of the elements in that range. All elements in the managed element blocks within the range will be released and the container will no longer manage their life cycles after the call.
The method will throw an std::out_of_range
exception if either the starting or the ending position is outside the current container size.
start_pos | starting position |
end_pos | ending position, inclusive. |
iterator mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::release_range | ( | const iterator & | pos_hint, |
size_type | start_pos, | ||
size_type | end_pos | ||
) |
Make all elements within specified range empty, and relinquish the ownership of the elements in that range. All elements in the managed element blocks within the range will be released and the container will no longer manage their life cycles after the call.
This variant takes an iterator as an additional parameter, which is used as a block position hint to speed up the lookup of the first block to empty. The other variant that doesn't take an iterator always starts the block lookup from the first block, which does not scale well as the block size grows.
The method will throw an std::out_of_range
exception if either the starting or the ending position is outside the current container size.
pos_hint | iterator used as a block position hint, to specify which block to start when searching for the right blocks in which elements are to be released. |
start_pos | starting position |
end_pos | ending position, inclusive. |
void mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::resize | ( | size_type | new_size | ) |
Extend or shrink the container. When extending the container, it appends a series of empty elements to the end. When shrinking, the elements at the end of the container get stripped off.
new_size | size of the container after the resize. |
iterator mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::set | ( | size_type | pos, |
const _T & | value | ||
) |
Set a value of an arbitrary type to a specified position. The type of the value is inferred from the value passed to this method. The new value will overwrite an existing value at the specified position position if any.
The method will throw an std::out_of_range
exception if the specified position is outside the current container range.
Calling this method will not change the size of the container.
pos | position to insert the value to. |
value | value to insert. |
iterator mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::set | ( | const iterator & | pos_hint, |
size_type | pos, | ||
const _T & | value | ||
) |
Set a value of an arbitrary type to a specified position. The type of the value is inferred from the value passed to this method. The new value will overwrite an existing value at the specified position position if any.
This variant takes an iterator as an additional parameter, which is used as a block position hint to speed up the lookup of the right block to insert the value into. The other variant that doesn't take an iterator always starts the block lookup from the first block, which does not scale well as the block size grows.
This position hint iterator must precede the insertion position to yield any performance benefit.
The caller is responsible for ensuring that the passed iterator is valid. The behavior of this method when passing an invalid iterator is undefined.
The method will throw an std::out_of_range
exception if the specified position is outside the current container range.
Calling this method will not change the size of the container.
pos_hint | iterator used as a block position hint, to specify which block to start when searching for the right block to insert the value into. |
pos | position to insert the value to. |
value | value to insert. |
iterator mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::set | ( | size_type | pos, |
const _T & | it_begin, | ||
const _T & | it_end | ||
) |
Set multiple values of identical type to a range of elements starting at specified position. Any existing values will be overwritten by the new values.
The method will throw an std::out_of_range
exception if the range of new values would fall outside the current container range.
Calling this method will not change the size of the container.
pos | position of the first value of the series of new values being inserted. |
it_begin | iterator that points to the begin position of the values being set. |
it_end | iterator that points to the end position of the values being set. |
iterator mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::set | ( | const iterator & | pos_hint, |
size_type | pos, | ||
const _T & | it_begin, | ||
const _T & | it_end | ||
) |
Set multiple values of identical type to a range of elements starting at specified position. Any existing values will be overwritten by the new values.
This variant takes an iterator as an additional parameter, which is used as a block position hint to speed up the lookup of the first insertion block. The other variant that doesn't take an iterator always starts the block lookup from the first block, which does not scale well as the block size grows.
This position hint iterator must precede the insertion position to yield any performance benefit.
The caller is responsible for ensuring that the passed iterator is valid. The behavior of this method when passing an invalid iterator is undefined.
The method will throw an std::out_of_range
exception if the range of new values would fall outside the current container range.
Calling this method will not change the size of the container.
pos_hint | iterator used as a block position hint, to specify which block to start when searching for the right block to insert the value into. |
pos | position of the first value of the series of new values being inserted. |
it_begin | iterator that points to the begin position of the values being set. |
it_end | iterator that points to the end position of the values being set. |
iterator mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::set_empty | ( | size_type | start_pos, |
size_type | end_pos | ||
) |
Set specified range of elements to be empty. Any existing values will be overwritten.
The method will throw an std::out_of_range
exception if either the starting or the ending position is outside the current container size.
start_pos | starting position |
end_pos | ending position, inclusive. |
iterator mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::set_empty | ( | const iterator & | pos_hint, |
size_type | start_pos, | ||
size_type | end_pos | ||
) |
Set specified range of elements to be empty. Any existing values will be overwritten.
This variant takes an iterator as an additional parameter, which is used as a block position hint to speed up the lookup of the first block to empty. The other variant that doesn't take an iterator always starts the block lookup from the first block, which does not scale well as the block size grows.
This position hint iterator must precede the start position to yield any performance benefit.
The caller is responsible for ensuring that the passed iterator is valid. The behavior of this method when passing an invalid iterator is undefined.
The method will throw an std::out_of_range
exception if either the starting or the ending position is outside the current container size.
pos_hint | iterator used as a block position hint, to specify which block to start when searching for the right blocks to empty. |
start_pos | starting position |
end_pos | ending position, inclusive. |
void mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::shrink_to_fit | ( | ) |
Trim excess capacity from all non-empty blocks.
size_type mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::size | ( | ) | const |
Return the current container size.
void mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::swap | ( | multi_type_vector< _ElemBlockFunc, _EventFunc > & | other | ) |
Swap the content with another container.
other | another container to swap content with. |
void mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::swap | ( | size_type | start_pos, |
size_type | end_pos, | ||
multi_type_vector< _ElemBlockFunc, _EventFunc > & | other, | ||
size_type | other_pos | ||
) |
Swap a part of the content with another container.
start_pos | starting position |
end_pos | ending position, inclusive. |
other | another container to swap the content with. |
other_pos | insertion position in the other container. |
iterator mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::transfer | ( | size_type | start_pos, |
size_type | end_pos, | ||
multi_type_vector< _ElemBlockFunc, _EventFunc > & | dest, | ||
size_type | dest_pos | ||
) |
Move elements from one container to another. After the move, the segment where the elements were in the source container becomes empty. When transferring managed elements, this call transfers ownership of the moved elements to the destination container. The moved elements will overwrite any existing elements in the destination range of the receiving container. Transfer of elements within the same container is not allowed.
The method will throw an std::out_of_range
exception if either the starting or the ending position is greater than or equal to the source container size, or the destination container is not large enough to accommodate the transferred elements.
start_pos | starting position |
end_pos | ending position, inclusive. |
dest | destination container to which the elements are to be moved. |
dest_pos | position in the destination container to which the elements are to be moved. |
iterator mdds::multi_type_vector< _ElemBlockFunc, _EventFunc >::transfer | ( | const iterator & | pos_hint, |
size_type | start_pos, | ||
size_type | end_pos, | ||
multi_type_vector< _ElemBlockFunc, _EventFunc > & | dest, | ||
size_type | dest_pos | ||
) |
Move elements from one container to another. After the move, the segment where the elements were in the source container becomes empty. When transferring managed elements, this call transfers ownership of the moved elements to the new container. The moved elements will overwrite any existing elements in the destination range of the receiving container. Transfer of elements within the same container is not allowed.
The method will throw an std::out_of_range
exception if either the starting or the ending position is greater than or equal to the source container size, or the destination container is not large enough to accommodate the transferred elements.
pos_hint | iterator used as a block position hint, to specify which block to start when searching for the blocks where the elements to be transferred reside. |
start_pos | starting position |
end_pos | ending position, inclusive. |
dest | destination container to which the elements are to be moved. |
dest_pos | position in the destination container to which the elements are to be moved. |