phdMesh
Version of the Day
|
A TypeList based enumeration of numeric types. More...
Classes | |
struct | phdmesh::NumericEnum< Type > |
Map a numeric scalar Type to an integer value. More... | |
struct | phdmesh::NumericEnum< void > |
Map the integer value associated with a numeric scalar type to a text name or byte size. More... | |
struct | phdmesh::NumericType< Ordinal > |
Inverse map of a numeric scalar type to an integer value. More... | |
A TypeList based enumeration of numeric types.
A TypeList is used instead of declaring an enum so that the integer values are clearly defined and extension of the list is robust.
An enumeration value for a type is given by: NumericEnum< Type >::value . Thus a switch statement for a numeric type is formed as follows.
switch( my_value ) {
case NumericEnum< int >::value : ... ; break ;
case NumericEnum< float >::value : ... ; break ;
case NumericEnum< double >::value : ... ; break ;
default: ... ;
}