tinympl  0.2
mini MPL library for C++11
tinympl::map< Args > Class Template Reference

A compile time map from a type to another This class represents a compile time mapping between types. The mapping is specified using std::pair, that is every parameter of map must be an std::pair<KeyType,ValueType>. More...

#include <tinympl/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 Key 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...
 

Public Types

enum  { size = sizeof ... (Args) }
 
enum  { empty = (size == 0) }
 
template<class Key >
using count = std::integral_constant< std::size_t,(variadic::find< Key, 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... Args>
class tinympl::map< Args >

A compile time map from a type to another This class represents a compile time mapping between types. The mapping is specified using std::pair, that is every parameter of map must be an std::pair<KeyType,ValueType>.

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... Args>
template<class Key >
using tinympl::map< Args >::count = std::integral_constant< std::size_t, (variadic::find<Key, 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... Args>
anonymous enum
Enumerator
size 

The number of elements contained in the map.

template<class... Args>
anonymous enum
Enumerator
empty 

Determines whether the map is empty.


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