Celeritas  0.5.0-86+4a8eea4
Public Types | Public Member Functions | Public Attributes | List of all members
celeritas::EnumArray< E, T > Struct Template Reference

Thin wrapper for an array of enums for accessing by enum instead of int. More...

#include <EnumArray.hh>

Public Types

enum  { N = static_cast<size_type>(key_type::size_) }
 
Type aliases
using key_type = E
 
using value_type = T
 
using size_type = std::underlying_type_t< E >
 
using pointer = value_type *
 
using const_pointer = value_type const *
 
using reference = value_type &
 
using const_reference = value_type const &
 
using iterator = pointer
 
using const_iterator = const_pointer
 

Public Member Functions

CELER_FORCEINLINE_FUNCTION reference operator[] (key_type const &k)
 Get an element.
 
CELER_FORCEINLINE_FUNCTION const_reference operator[] (key_type const &k) const
 Get an element (const)
 
CELER_FORCEINLINE_FUNCTION const_reference front () const
 
CELER_FORCEINLINE_FUNCTION reference front ()
 
CELER_FORCEINLINE_FUNCTION const_reference back () const
 
CELER_FORCEINLINE_FUNCTION reference back ()
 
CELER_FORCEINLINE_FUNCTION const_pointer data () const
 
CELER_FORCEINLINE_FUNCTION pointer data ()
 
CELER_FORCEINLINE_FUNCTION iterator begin ()
 
CELER_FORCEINLINE_FUNCTION iterator end ()
 
CELER_FORCEINLINE_FUNCTION const_iterator begin () const
 
CELER_FORCEINLINE_FUNCTION const_iterator end () const
 
CELER_FORCEINLINE_FUNCTION const_iterator cbegin () const
 
CELER_FORCEINLINE_FUNCTION const_iterator cend () const
 
CELER_CONSTEXPR_FUNCTION bool empty () const
 
CELER_CONSTEXPR_FUNCTION size_type size () const
 

Public Attributes

data_ [N]
 Storage.
 

Detailed Description

template<class E, class T>
struct celeritas::EnumArray< E, T >

Thin wrapper for an array of enums for accessing by enum instead of int.

The enum must be a zero-indexed contiguous enumeration with a size_ enumeration as its last value.

Todo:
The template parameters are reversed!!!

Member Function Documentation

◆ back() [1/2]

template<class E , class T >
CELER_FORCEINLINE_FUNCTION reference celeritas::EnumArray< E, T >::back ( )
inline

Element access

◆ back() [2/2]

template<class E , class T >
CELER_FORCEINLINE_FUNCTION const_reference celeritas::EnumArray< E, T >::back ( ) const
inline

Element access

◆ begin() [1/2]

template<class E , class T >
CELER_FORCEINLINE_FUNCTION iterator celeritas::EnumArray< E, T >::begin ( )
inline

Iterator access

◆ begin() [2/2]

template<class E , class T >
CELER_FORCEINLINE_FUNCTION const_iterator celeritas::EnumArray< E, T >::begin ( ) const
inline

Iterator access

◆ cbegin()

template<class E , class T >
CELER_FORCEINLINE_FUNCTION const_iterator celeritas::EnumArray< E, T >::cbegin ( ) const
inline

Iterator access

◆ cend()

template<class E , class T >
CELER_FORCEINLINE_FUNCTION const_iterator celeritas::EnumArray< E, T >::cend ( ) const
inline

Iterator access

◆ data() [1/2]

template<class E , class T >
CELER_FORCEINLINE_FUNCTION pointer celeritas::EnumArray< E, T >::data ( )
inline

Element access

◆ data() [2/2]

template<class E , class T >
CELER_FORCEINLINE_FUNCTION const_pointer celeritas::EnumArray< E, T >::data ( ) const
inline

Element access

◆ empty()

template<class E , class T >
CELER_CONSTEXPR_FUNCTION bool celeritas::EnumArray< E, T >::empty ( ) const
inline

Capacity

◆ end() [1/2]

template<class E , class T >
CELER_FORCEINLINE_FUNCTION iterator celeritas::EnumArray< E, T >::end ( )
inline

Iterator access

◆ end() [2/2]

template<class E , class T >
CELER_FORCEINLINE_FUNCTION const_iterator celeritas::EnumArray< E, T >::end ( ) const
inline

Iterator access

◆ front() [1/2]

template<class E , class T >
CELER_FORCEINLINE_FUNCTION reference celeritas::EnumArray< E, T >::front ( )
inline

Element access

◆ front() [2/2]

template<class E , class T >
CELER_FORCEINLINE_FUNCTION const_reference celeritas::EnumArray< E, T >::front ( ) const
inline

Element access

◆ size()

template<class E , class T >
CELER_CONSTEXPR_FUNCTION size_type celeritas::EnumArray< E, T >::size ( ) const
inline

Capacity


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