- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
#include <iostream>
#include <boost/mpl/pair.hpp>
#include <boost/mpl/key_type.hpp>
#include <boost/mpl/map.hpp>
#include <boost/mpl/string.hpp>
#include <boost/mpl/for_each.hpp>
using namespace boost;
typedef mpl::map<
   mpl::pair<mpl::string<'H','e','l','l','o'>, mpl::int_<0>>,
   mpl::pair<mpl::string<',',' '>, mpl::int_<1>>,
   mpl::pair<mpl::string<'W','o','r','l','d','!'>, mpl::int_<2>>
> map;
struct do_some {
   template<typename T>
   void operator()(T) const {
      std::cout << mpl::c_str<T>::value;
   }
};
int main() {
   mpl::for_each<
      map,
      typename mpl::lambda<
         mpl::key_type<map, mpl::_1>
      >
   >(do_some());
}