LibreOffice Module o3tl (master) 1
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | List of all members
o3tl::enumarray< E, V > Class Template Referencefinal

This is a container convenience class for arrays indexed by enum values. More...

#include <enumarray.hxx>

Inheritance diagram for o3tl::enumarray< E, V >:
[legend]

Public Types

typedef enumarray< E, V > self_type
 
typedef enumarray_iterator< self_typeiterator
 
typedef enumarray_const_iterator< self_typeconst_iterator
 
typedef V value_type
 
typedef E key_type
 
typedef size_t size_type
 

Public Member Functions

template<typename... T>
constexpr enumarray (V const &arg, T &&...args)
 
 enumarray ()
 
const V & operator[] (E index) const
 
V & operator[] (E index)
 
void fill (V val)
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
V * data ()
 

Static Public Member Functions

static size_type size ()
 

Static Public Attributes

static const size_type max_index = static_cast<size_type>(E::LAST)
 

Private Attributes

std::array< V, max_index+1 > detail_values
 

Detailed Description

template<typename E, typename V>
class o3tl::enumarray< E, V >

This is a container convenience class for arrays indexed by enum values.

This assumes that the 'enum class' definition

Parameters
Ethe 'enum class' type.
Vthe value type to be stored in the array

Definition at line 47 of file enumarray.hxx.

Member Typedef Documentation

◆ const_iterator

template<typename E , typename V >
typedef enumarray_const_iterator<self_type> o3tl::enumarray< E, V >::const_iterator

Definition at line 52 of file enumarray.hxx.

◆ iterator

template<typename E , typename V >
typedef enumarray_iterator<self_type> o3tl::enumarray< E, V >::iterator

Definition at line 51 of file enumarray.hxx.

◆ key_type

template<typename E , typename V >
typedef E o3tl::enumarray< E, V >::key_type

Definition at line 55 of file enumarray.hxx.

◆ self_type

template<typename E , typename V >
typedef enumarray<E, V> o3tl::enumarray< E, V >::self_type

Definition at line 50 of file enumarray.hxx.

◆ size_type

template<typename E , typename V >
typedef size_t o3tl::enumarray< E, V >::size_type

Definition at line 56 of file enumarray.hxx.

◆ value_type

template<typename E , typename V >
typedef V o3tl::enumarray< E, V >::value_type

Definition at line 54 of file enumarray.hxx.

Constructor & Destructor Documentation

◆ enumarray() [1/2]

template<typename E , typename V >
template<typename... T>
constexpr o3tl::enumarray< E, V >::enumarray ( V const &  arg,
T &&...  args 
)
inlineconstexpr

Definition at line 66 of file enumarray.hxx.

References args, forward(), and o3tl::enumarray< E, V >::max_index.

◆ enumarray() [2/2]

template<typename E , typename V >
o3tl::enumarray< E, V >::enumarray ( )
inline

Definition at line 73 of file enumarray.hxx.

Member Function Documentation

◆ begin() [1/2]

template<typename E , typename V >
iterator o3tl::enumarray< E, V >::begin ( )
inline

Definition at line 91 of file enumarray.hxx.

◆ begin() [2/2]

template<typename E , typename V >
const_iterator o3tl::enumarray< E, V >::begin ( ) const
inline

Definition at line 93 of file enumarray.hxx.

◆ data()

template<typename E , typename V >
V * o3tl::enumarray< E, V >::data ( )
inline

Definition at line 96 of file enumarray.hxx.

References o3tl::enumarray< E, V >::detail_values, and V.

◆ end() [1/2]

template<typename E , typename V >
iterator o3tl::enumarray< E, V >::end ( )
inline

Definition at line 92 of file enumarray.hxx.

References o3tl::enumarray< E, V >::size().

◆ end() [2/2]

template<typename E , typename V >
const_iterator o3tl::enumarray< E, V >::end ( ) const
inline

Definition at line 94 of file enumarray.hxx.

References o3tl::enumarray< E, V >::size().

◆ fill()

template<typename E , typename V >
void o3tl::enumarray< E, V >::fill ( val)
inline

◆ operator[]() [1/2]

template<typename E , typename V >
V & o3tl::enumarray< E, V >::operator[] ( index)
inline

Definition at line 81 of file enumarray.hxx.

References o3tl::enumarray< E, V >::detail_values, E, index, and V.

◆ operator[]() [2/2]

template<typename E , typename V >
const V & o3tl::enumarray< E, V >::operator[] ( index) const
inline

Definition at line 75 of file enumarray.hxx.

References o3tl::enumarray< E, V >::detail_values, E, index, and V.

◆ size()

template<typename E , typename V >
static size_type o3tl::enumarray< E, V >::size ( )
inlinestatic

Definition at line 90 of file enumarray.hxx.

References o3tl::enumarray< E, V >::max_index.

Referenced by o3tl::enumarray< E, V >::end().

Member Data Documentation

◆ detail_values

template<typename E , typename V >
std::array<V, max_index + 1> o3tl::enumarray< E, V >::detail_values
private

◆ max_index

template<typename E , typename V >
const size_type o3tl::enumarray< E, V >::max_index = static_cast<size_type>(E::LAST)
static

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