Honeycomb
0.1
Component-Model Framework
|
A compile-time associative heterogeneous container. More...
Classes | |
class | honey::MtMapElem< Key_, Val_, List_ > |
Map element in recursive list. More... | |
struct | honey::MtPair< Key_, Val_ > |
Key/value pair. A pair can be constructed with the syntax: (key() = value) More... | |
class | honey::MtMapIter< Head, Elem > |
Bidirectional iterator over map key/value pairs. More... | |
struct | honey::MtMapCommon< Subclass, Key_, Val_, List_ >::priv< isTail, _ >::findElem< Key, Prev_ > |
Specialize for our key. More... | |
struct | honey::MtMapCommon< Subclass, Key_, Val_, List_ >::priv< true, _ >::findElem< Key, Prev_ > |
class | honey::MtMapCommon< Subclass, Key_, Val_, List_ > |
Common functions between map elem and the map tail specialization. Use through class MtMapElem. More... | |
Macros | |
#define | mtkey(Name) |
Construct a key type with name. More... | |
#define | mtkeygen(Name) |
Construct a templated key generator that creates keys from static ints. More... | |
Typedefs | |
typedef MtMapElem< mt::Void, mt::Void, mt::Void > | honey::MtMapTail |
Tail of map list. More... | |
template<class... Pairs> | |
using | honey::MtMap = typename priv::MtMap_< Pairs... >::type |
Declare a map type with MtMap<Val1,Key1, Val2,Key2, ...> More... | |
Functions | |
template<class... Pairs> | |
auto | honey::mtmap (Pairs &&...pairs) -> decltype(priv::mtmap_(priv::PairSeqGen< Pairs... >(), forward< Pairs >(pairs)...)) |
Construct a map from (key() = value) pairs. More... | |
template<class Iter1 , class Iter2 , class Func > | |
auto | honey::for_each_mtmap (Iter1 itBegin, Iter2 itEnd, Func &&func) -> typename std::enable_if<!std::is_same< typename Iter1::Pair::Key, typename Iter2::Pair::Key >::value >::type |
Iterate over map calling functor (visitor) for each key/value pair. More... | |
A compile-time associative heterogeneous container.
Each value may have a different type. Lookups are resolved at compile-time, so they are O(1) constant-time.
Features:
For unwieldly functions with many arguments a map is ideal to enable "keyword arguments", see the example.
The map can also be used as an indexable array, see mtkeygen and the example.
Example:
#define mtkey | ( | Name | ) |
Construct a key type with name.
#define mtkeygen | ( | Name | ) |
Construct a templated key generator that creates keys from static ints.
using honey::MtMap = typedef typename priv::MtMap_<Pairs...>::type |
Declare a map type with MtMap<Val1,Key1, Val2,Key2, ...>
typedef MtMapElem<mt::Void, mt::Void, mt::Void> honey::MtMapTail |
Tail of map list.
auto honey::for_each_mtmap | ( | Iter1 | itBegin, |
Iter2 | itEnd, | ||
Func && | func | ||
) | -> typename std::enable_if<!std::is_same<typename Iter1::Pair::Key, typename Iter2::Pair::Key>::value>::type |
Iterate over map calling functor (visitor) for each key/value pair.
auto honey::mtmap | ( | Pairs &&... | pairs | ) | -> decltype(priv::mtmap_(priv::PairSeqGen<Pairs...>(), forward<Pairs>(pairs)...)) |
Construct a map from (key() = value)
pairs.