Stride Reference Manual  - generated for commit 9643b11
stride::ContactType::IdSubscriptArray< T > Class Template Reference

An std::array modified to enable subscripting with the constact pool type indentifiers. More...

#include <IdSubscriptArray.h>

Inheritance diagram for stride::ContactType::IdSubscriptArray< T >:
Inheritance graph
Collaboration diagram for stride::ContactType::IdSubscriptArray< T >:
Collaboration graph

Public Member Functions

 IdSubscriptArray (T t)
 What we 'll use most often and where we can have a default and initialize all array elements to the same value. More...
 
 IdSubscriptArray ()
 
 IdSubscriptArray (std::initializer_list< T > l)
 When we want to use an initializer list the elements is the (possibly emty) initializer list are applied to the first elements in order; any remaininig elements are default initialized. More...
 
 IdSubscriptArray (std::array< T, NumOfTypes()> &&l)
 Initialize with an array of the right dimensions. More...
 
std::array< T, NumOfTypes()>::reference operator[] (ContactType::Id id)
 This actually works in itself but interferes annoyingly with the first constructor above and is for practical purpose redundant. More...
 
std::array< T, NumOfTypes()>::const_reference operator[] (ContactType::Id id) const
 Subscripting with pool typ id as argument. More...
 
std::array< T, NumOfTypes()>::reference at (ContactType::Id id)
 Subscripting with pool typ id as argument. More...
 
std::array< T, NumOfTypes()>::const_reference at (ContactType::Id id) const
 Subscripting with pool typ id as argument. More...
 

Detailed Description

template<class T>
class stride::ContactType::IdSubscriptArray< T >

An std::array modified to enable subscripting with the constact pool type indentifiers.

The bounds checking "at" method, to protevt against a subscript that is static_cast<Id> from an erroneous integer value.

We intentionally shadow the direct subscripting of the base array.

Writing constructor is somehat weird since std::array has no constructors, only aggregate initialization. But we want some constructors for shorthand expressions.

Template Parameters
Tbase type of the array.

Definition at line 48 of file IdSubscriptArray.h.

Constructor & Destructor Documentation

template<class T>
stride::ContactType::IdSubscriptArray< T >::IdSubscriptArray ( t)
inlineexplicit

What we 'll use most often and where we can have a default and initialize all array elements to the same value.

e.g. IdSubscriptArray<unsigned int> m(1U);

Definition at line 54 of file IdSubscriptArray.h.

template<class T>
stride::ContactType::IdSubscriptArray< T >::IdSubscriptArray ( )
inlineexplicit

Definition at line 61 of file IdSubscriptArray.h.

template<class T>
stride::ContactType::IdSubscriptArray< T >::IdSubscriptArray ( std::initializer_list< T >  l)
inline

When we want to use an initializer list the elements is the (possibly emty) initializer list are applied to the first elements in order; any remaininig elements are default initialized.

e.g. IdSubscriptArray<unsigned int> mm {1U, 2U, 2U};

Definition at line 72 of file IdSubscriptArray.h.

template<class T>
stride::ContactType::IdSubscriptArray< T >::IdSubscriptArray ( std::array< T, NumOfTypes()> &&  l)
inlineexplicit

Initialize with an array of the right dimensions.

Makes sure nothing is default constructed Delegate it to the array move constructor Destructive...

Definition at line 89 of file IdSubscriptArray.h.

Member Function Documentation

template<class T>
std::array<T, NumOfTypes()>::reference stride::ContactType::IdSubscriptArray< T >::operator[] ( ContactType::Id  id)
inline

This actually works in itself but interferes annoyingly with the first constructor above and is for practical purpose redundant.

Forward constructor arguments to base class. template <typename... Args> explicit IdSubscriptArray(Args&&... args) : std::array<T, NumOfTypes()>{{std::forward<Args>(args)...}}{} Subscripting with pool typ id as argument.

Definition at line 99 of file IdSubscriptArray.h.

Referenced by stride::ContactType::IdSubscriptArray< AgeContactProfile >::IdSubscriptArray(), and stride::ContactType::IdSubscriptArray< bool >::IdSubscriptArray().

Here is the caller graph for this function:

template<class T>
std::array<T, NumOfTypes()>::const_reference stride::ContactType::IdSubscriptArray< T >::operator[] ( ContactType::Id  id) const
inline

Subscripting with pool typ id as argument.

Definition at line 105 of file IdSubscriptArray.h.

template<class T>
std::array<T, NumOfTypes()>::reference stride::ContactType::IdSubscriptArray< T >::at ( ContactType::Id  id)
inline

Subscripting with pool typ id as argument.

Definition at line 111 of file IdSubscriptArray.h.

template<class T>
std::array<T, NumOfTypes()>::const_reference stride::ContactType::IdSubscriptArray< T >::at ( ContactType::Id  id) const
inline

Subscripting with pool typ id as argument.

Definition at line 120 of file IdSubscriptArray.h.


The documentation for this class was generated from the following file: