Loading...
Searching...
No Matches
mdds::mtv::collection< _MtvT > Class Template Reference

`#include <collection.hpp>`

## Public Types

typedef _MtvT | mtv_type
typedef mtv_type::size_type | size_type
typedef detail::side_iterator< mtv_type > | const_iterator
| collection range.

## Public Member Functions

template<typename _T>
| collection (const _T &begin, const _T &end)
const_iterator | begin () const
const_iterator | end () const
size_type | size () const
void | swap (collection &other)
void | set_collection_range (size_type start, size_type size)
void | set_element_range (size_type start, size_type size)

## Detailed Description

template<typename _MtvT>
class mdds::mtv::collection< _MtvT >

Special-purpose collection of multiple multi_type_vector instances to allow them to be traversed "sideways" i.e. orthogonal to the direction of the vector instances. All involved multi_type_vector instances must be of the same type and length.

## Constructor & Destructor Documentation

## collection()

template<typename _MtvT>
template<typename _T>

mdds::mtv::collection< _MtvT >::collection | ( | const _T & | begin,
|  | const _T & | end )

Constructor that takes the start and end iterators of the multi_type_vector instances to reference in the collection.

Parameters

  begin | iterator that references the first multi_type_vector instance to place in the collection.
  end | iterator that references the position past the last multi_type_vector instance to place in the collection.

## Member Function Documentation

## begin()

template<typename _MtvT>

const_iterator mdds::mtv::collection< _MtvT >::begin | ( |  | ) | const

Return an iterator that references the first element in the collection.

Returns
  iterator that references the first element in the collection.

## end()

template<typename _MtvT>

const_iterator mdds::mtv::collection< _MtvT >::end | ( |  | ) | const

Return an iterator that references the position past the last element in the collection.

Returns
  iterator that references the position past the last element in the collection.

## set_collection_range()

template<typename _MtvT>

void mdds::mtv::collection< _MtvT >::set_collection_range | ( | size_type | start,
|  | size_type | size )

Set the sub-range of the collection to iterate through.

For instance, if the collection consists of 100 multi_type_vector instances, and you want to iterate through only 50 of them starting from the second instance, you set the start index to 1 (as it's 0-based), and the size to 50.

Parameters

  start | 0-based index of the first multi_type_vector instance to iterate through.
  size | length of the collection range i.e. the number of vector instances to iterate through starting from the specified first vector instance.

## set_element_range()

template<typename _MtvT>

void mdds::mtv::collection< _MtvT >::set_element_range | ( | size_type | start,
|  | size_type | size )

Set the sub element range to iterate through. This limits the element range in each multi_type_vector instance to iterate through. The direction of the element range is orthogonal to the direction of the collection range.

For instance, if the collection consists of multiple multi_type_vector instances all of which have a length of 50, and you only wish to iterate from the 3rd element through the 10th element in each vector instance, then you set the start index to 2 and the size to 8.

Parameters

  start | 0-based index of the starting element position.
  size | length of the element range to iterate through starting from the specified start element position.

## size()

template<typename _MtvT>

size_type mdds::mtv::collection< _MtvT >::size | ( |  | ) | const

Return the length of the vector instances stored in the collection. This will be equivalent of the length of each multi_type_vector instance, since all stored instances have the same length.

Returns
  length of the stored multi_type_vector instances.

## swap()

template<typename _MtvT>

void mdds::mtv::collection< _MtvT >::swap | ( | collection< _MtvT > & | other | ) |

Swap the entire collection with another collection instance.

Parameters

  other | another collection instance to swap contents with.