This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <boost/mpl/map.hpp> | |
#include <boost/mpl/pair.hpp> | |
#include <boost/mpl/at.hpp> | |
#include <boost/type_traits/is_same.hpp> | |
#include <boost/mpl/assert.hpp> | |
#include <cstdio> | |
typedef boost::mpl::map< | |
boost::mpl::pair<int,unsigned> | |
, boost::mpl::pair<char,unsigned char> | |
, boost::mpl::pair<int[42],bool> | |
> m; | |
int main() | |
{ | |
BOOST_MPL_ASSERT(( boost::is_same< boost::mpl::at<m,int>::type, unsigned > )); | |
boost::mpl::at<m,int>::type x; | |
x = 5; | |
printf("x=%u\n", x); | |
return 0; | |
} |
When run:
kuyu@castor-ub:~/dkuyu/Dropbox/practice/cpp/boost/mpl$ g++ -I/home/kuyu/dkuyu/bin/boost_1_60_0 map.cpp && ./a.out
x=5