tinympl  0.2
mini MPL library for C++11
tinympl::value_map< KeyType, ValueType, Args > Class Template Reference

A compile time map from a compile-time value to another This class represents a compile time mapping between values. The first two parameters are respectively the type of the key and of the values. The mapping is specified using std::pair, that is every parameter of map must be an std::pair< std::integral_constant<KeyType,key>,std::integral_constant<ValueType,value> > More...

#include <tinympl/value_map.hpp>

Classes

class  at
 Return the value element with the given key. More...
 
class  erase
 Return a new map constructed by the current map removing the k key, if present, otherwise return the current map. More...
 
class  insert
 Returns a new map with the new Key/Value pair, or this map if the key is already present in the map. More...
 
class  insert_many
 Calls insert many times to insert many Key/Value pairs. More...
 
struct  is_valid_key_type
 Determines whether T is a valid key type, i.e. std::integral_constant<KeyType,KeyValue> More...
 
struct  is_valid_value_type
 Determines whether T is a valid value type, i.e. std::integral_constant<ValueType,Value> More...
 

Public Types

enum  { size = sizeof ... (Args) }
 
enum  { empty = (size == 0) }
 
template<KeyType k>
using key = std::integral_constant< KeyType, k >
 Convenience using-declaration to quickly define keys for this value_map
 
template<ValueType v>
using value = std::integral_constant< ValueType, v >
 Convenience using-declaration to quickly define values for this value_map
 
template<KeyType k, ValueType v>
using pair = std::pair< key< k >, value< v > >
 Convenience using-declaration to quickly define a key/value pair for this value_map
 
template<KeyType k>
using count = std::integral_constant< std::size_t,(variadic::find< key< k >, typename Args::first_type... >::type::value==size?0:1)>
 Count the number of elements in the map with a given key. More...
 

Detailed Description

template<class KeyType, class ValueType, class... Args>
class tinympl::value_map< KeyType, ValueType, Args >

A compile time map from a compile-time value to another This class represents a compile time mapping between values. The first two parameters are respectively the type of the key and of the values. The mapping is specified using std::pair, that is every parameter of map must be an std::pair< std::integral_constant<KeyType,key>,std::integral_constant<ValueType,value> >

value_map supports standard insertion/removal and element access.

Note
equal_to is specialized for map, in order to make the order in which the key/value pairs are specified irrelevant.

Member Typedef Documentation

template<class KeyType , class ValueType , class... Args>
template<KeyType k>
using tinympl::value_map< KeyType, ValueType, Args >::count = std::integral_constant< std::size_t, (variadic::find<key<k>, typename Args::first_type ... >::type::value == size ? 0 : 1)>

Count the number of elements in the map with a given key.

Note
Since this class is a map and not a multimap, the only possible results for this operation are 0 and 1.

Member Enumeration Documentation

template<class KeyType , class ValueType , class... Args>
anonymous enum
Enumerator
size 

The number of elements contained in the map.

template<class KeyType , class ValueType , class... Args>
anonymous enum
Enumerator
empty 

Determines whether the map is empty.


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