Loading...
Searching...
No Matches
mdds::mtv::aos::multi_type_vector< Traits > Class Template Reference

`#include <main.hpp>`

## Public Types

using | size_type = std::size_t
using | block_funcs = typename Traits::block_funcs
using | event_func = typename Traits::event_func
typedef detail::iterator_base< iterator_trait, itr_forward_update > | iterator
typedef detail::iterator_base< reverse_iterator_trait, itr_no_update > | reverse_iterator
typedef detail::const_iterator_base< const_iterator_trait, itr_forward_update, iterator > | const_iterator
typedef detail::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 () noexcept(nothrow_default_constructible_v)
| 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 (multi_type_vector &&other) noexcept(nothrow_move_constructible_v)
| ~multi_type_vector ()
multi_type_vector | clone () const
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 (T &&value)
iterator | push_back_empty ()
template<typename T, typename... Args>
iterator | emplace_back (Args &&... args)
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 noexcept(std::is_nothrow_copy_constructible_v< size_type >)
size_type | block_size () const noexcept
bool | empty () const noexcept
void | resize (size_type new_size)
void | swap (multi_type_vector &other) noexcept(nothrow_swappable_v)
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)
multi_type_vector & | operator= (multi_type_vector &&other) noexcept(nothrow_move_assignable_v)

## 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) noexcept(std::is_fundamental_v< size_type >)
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)

## Detailed Description

template<typename Traits = mdds::mtv::default_traits>
class mdds::mtv::aos::multi_type_vector< Traits >

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.

This variant implements an array-of-structures (AoS) storage.

See also
  mdds::mtv::aos::multi_type_vector::value_type

## Member Typedef Documentation

## event_func

template<typename Traits = mdds::mtv::default_traits>

using mdds::mtv::aos::multi_type_vector< Traits >::event_func = typename Traits::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.

See also
  mdds::mtv::empty_event_func for the precise function signatures of the event handler functions.

## value_type

template<typename Traits = mdds::mtv::default_traits>

typedef itr_node mdds::mtv::aos::multi_type_vector< Traits >::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.

## Constructor & Destructor Documentation

## multi_type_vector() [1/8]

template<typename Traits = mdds::mtv::default_traits>

mdds::mtv::aos::multi_type_vector< Traits >::multi_type_vector | ( |  | ) | const

noexcept

Default constructor. It initializes the container with empty size.

## multi_type_vector() [2/8]

template<typename Traits = mdds::mtv::default_traits>

mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  hdl | lvalue reference to an event handler object.

## multi_type_vector() [3/8]

template<typename Traits = mdds::mtv::default_traits>

mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  hdl | rvalue reference to an event handler object.

## multi_type_vector() [4/8]

template<typename Traits = mdds::mtv::default_traits>

mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  init_size | initial container size.

## multi_type_vector() [5/8]

template<typename Traits = mdds::mtv::default_traits>
template<typename T>

mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  init_size | initial container size.
  value | initial element value.

## multi_type_vector() [6/8]

template<typename Traits = mdds::mtv::default_traits>
template<typename T>

mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  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.

## multi_type_vector() [7/8]

template<typename Traits = mdds::mtv::default_traits>

mdds::mtv::aos::multi_type_vector< Traits >::multi_type_vector | ( | const multi_type_vector< Traits > & | other | ) |

Copy constructor.

Parameters

  other | the other instance to copy values from.

## multi_type_vector() [8/8]

template<typename Traits = mdds::mtv::default_traits>

mdds::mtv::aos::multi_type_vector< Traits >::multi_type_vector | ( | multi_type_vector< Traits > && | other | ) | const

noexcept

Move constructor.

Parameters

  other | the other instance to move values from.

## ~multi_type_vector()

template<typename Traits = mdds::mtv::default_traits>

mdds::mtv::aos::multi_type_vector< Traits >::~multi_type_vector | ( |  | ) |

Destructor. It deletes all allocated data blocks.

## Member Function Documentation

## advance_position() [1/2]

template<typename Traits = mdds::mtv::default_traits>

const_position_type mdds::mtv::aos::multi_type_vector< Traits >::advance_position | ( | const const_position_type & | pos,
|  | int | steps )

static

Increment or decrement the position object by specified steps. Caller must ensure the the position object is valid.

Parameters

  pos | position object.
  steps | steps to advance the position object.

Returns
  position object that points to the new logical position.

## advance_position() [2/2]

template<typename Traits = mdds::mtv::default_traits>

position_type mdds::mtv::aos::multi_type_vector< Traits >::advance_position | ( | const position_type & | pos,
|  | int | steps )

static

Increment or decrement the position object by specified steps. Caller must ensure the the position object is valid.

Parameters

  pos | position object.
  steps | steps to advance the position object.

Returns
  position object that points to the new logical position.

## block_size()

template<typename Traits = mdds::mtv::default_traits>

size_type mdds::mtv::aos::multi_type_vector< Traits >::block_size | ( |  | ) | const

noexcept

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.

Returns
  current number of blocks in the primary array.

## clear()

template<typename Traits = mdds::mtv::default_traits>

void mdds::mtv::aos::multi_type_vector< Traits >::clear | ( |  | ) |

Clear the content of the container. The size of the container will become zero after calling this method.

## clone()

template<typename Traits = mdds::mtv::default_traits>

multi_type_vector mdds::mtv::aos::multi_type_vector< Traits >::clone | ( |  | ) | const

Clone the entire content of container. What this method does is very similar to what the copy constructor does except that this method allows cloning of non-copyable element blocks if specializations of mdds::mtv::clone_value template type exist for the value types stored in the element blocks being cloned.

Returns
  Brand-new instance containing the same content as the original instance.

Exceptions

  mdds::mtv::element_block_error | No specialization exists for at least one affected value type.

## emplace_back()

template<typename Traits = mdds::mtv::default_traits>
template<typename T, typename... Args>

iterator mdds::mtv::aos::multi_type_vector< Traits >::emplace_back | ( | Args &&... | args | ) |

Append a new element to the end of the container.

The new element is constructed by using the emplace_back() method of the destination element block, and the arguments args... are forwarded to it via std::forward<Args>(args)....

Parameters

  args | Arguments to forward to the emplace_back() method of the destination element block.

Returns
  Iterator position pointing to the block where the value is appended, which in this case is always the last block of the container.

Note
  Due to the limitation of the current implementation, this method requires the value type T to be default-constructible.

## empty()

template<typename Traits = mdds::mtv::default_traits>

bool mdds::mtv::aos::multi_type_vector< Traits >::empty | ( |  | ) | const

noexcept

Return whether or not the container is empty.

Returns
  true if the container is empty, false otherwise.

## erase()

template<typename Traits = mdds::mtv::default_traits>

void mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  start_pos | starting position
  end_pos | ending position, inclusive.

## get() [1/3]

template<typename Traits = mdds::mtv::default_traits>
template<typename Blk>

Blk::value_type mdds::mtv::aos::multi_type_vector< Traits >::get | ( | const const_position_type & | pos | ) |

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.

Parameters

  pos | position object.

Returns
  element value.

## get() [2/3]

template<typename Traits = mdds::mtv::default_traits>
template<typename T>

T mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  pos | position of the element value to retrieve.

Returns
  element value.

## get() [3/3]

template<typename Traits = mdds::mtv::default_traits>
template<typename T>

void mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  pos | position of the element value to retrieve.
  value | (out) variable to store the retrieved value.

## get_element_type()

template<typename Traits = mdds::mtv::default_traits>
template<typename T>

mtv::element_t mdds::mtv::aos::multi_type_vector< Traits >::get_element_type | ( | const T & | elem | ) |

static

Return the numerical identifier that represents passed element.

Parameters

  elem | element value.

Returns
  numerical identifier representing the element.

## get_type()

template<typename Traits = mdds::mtv::default_traits>

mtv::element_t mdds::mtv::aos::multi_type_vector< Traits >::get_type | ( | size_type | pos | ) | const

Get the type of an element at specified position.

Parameters

  pos | position of the element.

Returns
  element type.

## insert() [1/2]

template<typename Traits = mdds::mtv::default_traits>
template<typename T>

iterator mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  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.

Returns
  iterator position pointing to the block where the value is inserted. When no value insertion occurs because the value set is empty, the end iterator position is returned.

## insert() [2/2]

template<typename Traits = mdds::mtv::default_traits>
template<typename T>

iterator mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  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.

Returns
  iterator position pointing to the block where the value is inserted. When no value insertion occurs because the value set is empty, the end iterator position is returned.

## insert_empty() [1/2]

template<typename Traits = mdds::mtv::default_traits>

iterator mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  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.

Returns
  iterator position pointing to the block where the empty range is inserted. When no insertion occurs because the length is zero, the end iterator position is returned.

## insert_empty() [2/2]

template<typename Traits = mdds::mtv::default_traits>

iterator mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  pos | position at which to insert a range of empty elements.
  length | number of empty elements to insert.

Returns
  iterator position pointing to the block where the empty range is inserted. When no insertion occurs because the length is zero, the end iterator position is returned.

## is_empty()

template<typename Traits = mdds::mtv::default_traits>

bool mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  pos | position of the element to check.

Returns
  true if the element is empty, false otherwise.

## logical_position()

template<typename Traits = mdds::mtv::default_traits>

size_type mdds::mtv::aos::multi_type_vector< Traits >::logical_position | ( | const const_position_type & | pos | ) |

static noexcept

Extract the logical position from a position object.

Parameters

  pos | position object.

Returns
  logical position of the element that the position object references.

## next_position() [1/2]

template<typename Traits = mdds::mtv::default_traits>

const_position_type mdds::mtv::aos::multi_type_vector< Traits >::next_position | ( | const const_position_type & | pos | ) |

static

Move the position object to the next logical position. Caller must ensure the the position object is valid.

Parameters

  pos | position object.

Returns
  position object that points to the next logical position.

## next_position() [2/2]

template<typename Traits = mdds::mtv::default_traits>

position_type mdds::mtv::aos::multi_type_vector< Traits >::next_position | ( | const position_type & | pos | ) |

static

Move the position object to the next logical position. Caller must ensure the the position object is valid.

Parameters

  pos | position object.

Returns
  position object that points to the next logical position.

## position() [1/4]

template<typename Traits = mdds::mtv::default_traits>

const_position_type mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  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.

Returns
  position object that stores an iterator referencing the element block where the element resides, and its offset within the block.

## position() [2/4]

template<typename Traits = mdds::mtv::default_traits>

position_type mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  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.

Returns
  position object that stores an iterator referencing the element block where the element resides, and its offset within that block.

## position() [3/4]

template<typename Traits = mdds::mtv::default_traits>

position_type mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  pos | logical position of the element.

Returns
  position object that stores an iterator referencing the element block where the element resides, and its offset within that block.

## position() [4/4]

template<typename Traits = mdds::mtv::default_traits>

const_position_type mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  pos | position of the element.

Returns
  position object that stores an iterator referencing the element block where the element resides, and its offset within that block.

## push_back()

template<typename Traits = mdds::mtv::default_traits>
template<typename T>

iterator mdds::mtv::aos::multi_type_vector< Traits >::push_back | ( | T && | value | ) |

Append a new value to the end of the container.

This method takes the value either as an lvalue or rvalue reference and moves the passed value into the destination element block if the value is passed as an rvalue reference. Note, however, that the value may still be copied even if it is passed as an rvalue reference if the insertion triggers reallocation of the buffer in the destination block and the value type does not have a move constructor marked as noexcept.

Parameters

  value | New value to be appended to the end of the container.

Returns
  iterator position pointing to the block where the value is appended, which in this case is always the last block of the container.

## push_back_empty()

template<typename Traits = mdds::mtv::default_traits>

iterator mdds::mtv::aos::multi_type_vector< Traits >::push_back_empty | ( |  | ) |

Append a new empty element to the end of the container.

Returns
  iterator position pointing to the block where the new empty element is appended, which in this case is always the last block of the container.

## release() [1/4]

template<typename Traits = mdds::mtv::default_traits>

void mdds::mtv::aos::multi_type_vector< Traits >::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.

## release() [2/4]

template<typename Traits = mdds::mtv::default_traits>
template<typename T>

iterator mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  pos_hint | iterator used as a block position hint, to specify which block to start when searching for the block where the element resides.
  pos | position of the element to release.
  value | element value.

Returns
  iterator referencing the block where the position of the released element is.

## release() [3/4]

template<typename Traits = mdds::mtv::default_traits>
template<typename T>

T mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  pos | position of the element to release.

Returns
  element value.

## release() [4/4]

template<typename Traits = mdds::mtv::default_traits>
template<typename T>

iterator mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  pos | position of the element to release.
  value | element value.

Returns
  iterator referencing the block where the position of the released element is.

## release_range() [1/2]

template<typename Traits = mdds::mtv::default_traits>

iterator mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  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.

Returns
  iterator position pointing to the block where the elements are released.

## release_range() [2/2]

template<typename Traits = mdds::mtv::default_traits>

iterator mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  start_pos | starting position
  end_pos | ending position, inclusive.

Returns
  iterator position pointing to the block where the elements are released.

## resize()

template<typename Traits = mdds::mtv::default_traits>

void mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  new_size | size of the container after the resize.

## set() [1/4]

template<typename Traits = mdds::mtv::default_traits>
template<typename T>

iterator mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  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.

Returns
  iterator position pointing to the block where the value is inserted. When no value insertion occurs because the value set is empty, the end iterator position is returned.

## set() [2/4]

template<typename Traits = mdds::mtv::default_traits>
template<typename T>

iterator mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  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.

Returns
  iterator position pointing to the block where the value is inserted.

## set() [3/4]

template<typename Traits = mdds::mtv::default_traits>
template<typename T>

iterator mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  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.

Returns
  iterator position pointing to the block where the value is inserted. When no value insertion occurs because the value set is empty, the end iterator position is returned.

## set() [4/4]

template<typename Traits = mdds::mtv::default_traits>
template<typename T>

iterator mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  pos | position to insert the value to.
  value | value to insert.

Returns
  iterator position pointing to the block where the value is inserted.

## set_empty() [1/2]

template<typename Traits = mdds::mtv::default_traits>

iterator mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  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.

Returns
  iterator position pointing to the block where the elements are emptied.

## set_empty() [2/2]

template<typename Traits = mdds::mtv::default_traits>

iterator mdds::mtv::aos::multi_type_vector< Traits >::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.

Parameters

  start_pos | starting position
  end_pos | ending position, inclusive.

Returns
  iterator position pointing to the block where the elements are emptied.

## shrink_to_fit()

template<typename Traits = mdds::mtv::default_traits>

void mdds::mtv::aos::multi_type_vector< Traits >::shrink_to_fit | ( |  | ) |

Trim excess capacity from all non-empty blocks.

## size()

template<typename Traits = mdds::mtv::default_traits>

size_type mdds::mtv::aos::multi_type_vector< Traits >::size | ( |  | ) | const

noexcept

Return the current container size.

Returns
  current container size.

## swap() [1/2]

template<typename Traits = mdds::mtv::default_traits>

void mdds::mtv::aos::multi_type_vector< Traits >::swap | ( | multi_type_vector< Traits > & | other | ) |

noexcept

Swap the content with another container.

Parameters

  other | another container to swap content with.

## swap() [2/2]

template<typename Traits = mdds::mtv::default_traits>

void mdds::mtv::aos::multi_type_vector< Traits >::swap | ( | size_type | start_pos,
|  | size_type | end_pos,
|  | multi_type_vector< Traits > & | other,
|  | size_type | other_pos )

Swap a part of the content with another instance.

Parameters

  start_pos | starting position
  end_pos | ending position, inclusive.
  other | another instance to swap the content with.
  other_pos | insertion position in the other instance.

## transfer() [1/2]

template<typename Traits = mdds::mtv::default_traits>

iterator mdds::mtv::aos::multi_type_vector< Traits >::transfer | ( | const iterator & | pos_hint,
|  | size_type | start_pos,
|  | size_type | end_pos,
|  | multi_type_vector< Traits > & | 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.

Parameters

  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.

Returns
  iterator referencing the block where the moved elements were prior to the transfer.

## transfer() [2/2]

template<typename Traits = mdds::mtv::default_traits>

iterator mdds::mtv::aos::multi_type_vector< Traits >::transfer | ( | size_type | start_pos,
|  | size_type | end_pos,
|  | multi_type_vector< Traits > & | 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.

Parameters

  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.

Returns
  iterator referencing the block where the moved elements were prior to the transfer.