1 | #include <iostream>
|
---|
2 | #include <boost/fusion/include/map.hpp>
|
---|
3 | #include <boost/fusion/include/pair.hpp>
|
---|
4 | #include <boost/fusion/include/at_key.hpp>
|
---|
5 | #include <boost/fusion/include/at.hpp>
|
---|
6 | #include <boost/fusion/include/for_each.hpp>
|
---|
7 |
|
---|
8 | #include <string>
|
---|
9 |
|
---|
10 | struct print_me {
|
---|
11 | template<typename T> void operator()(T &t) const {
|
---|
12 | std::cout << t << std::endl;
|
---|
13 | }
|
---|
14 | };
|
---|
15 |
|
---|
16 | int main()
|
---|
17 | {
|
---|
18 | typedef boost::fusion::map<boost::fusion::pair<struct blah, short>,
|
---|
19 | boost::fusion::pair<struct bleh, int>,
|
---|
20 | boost::fusion::pair<struct foo, int[2]>,
|
---|
21 | boost::fusion::pair<struct bloog, std::string> > test_t;
|
---|
22 |
|
---|
23 | test_t test{1, 2, {}, {"hello"}};
|
---|
24 |
|
---|
25 | std::cout << boost::fusion::at_key<bleh>(test) << std::endl;
|
---|
26 |
|
---|
27 | boost::fusion::at_key<foo>(test)[0] = 5;
|
---|
28 |
|
---|
29 | boost::fusion::for_each(test, print_me());
|
---|
30 |
|
---|
31 | return 0;
|
---|
32 | }
|
---|
33 |
|
---|