| 1 | //Purpose:
|
|---|
| 2 | // See if empty list can be created and then
|
|---|
| 3 | // have elements appended to it.
|
|---|
| 4 | //
|
|---|
| 5 | //Without variadic fusion and with gcc4_4n.
|
|---|
| 6 | //
|
|---|
| 7 | #include <boost/fusion/container/list.hpp>
|
|---|
| 8 | #include <boost/fusion/include/size.hpp>
|
|---|
| 9 | #include <boost/fusion/algorithm/transformation/push_back.hpp>
|
|---|
| 10 | #include <boost/fusion/sequence/io.hpp>
|
|---|
| 11 |
|
|---|
| 12 | #include <iostream>
|
|---|
| 13 | #include <typeinfo>
|
|---|
| 14 |
|
|---|
| 15 | namespace boost
|
|---|
| 16 | {
|
|---|
| 17 | namespace fusion
|
|---|
| 18 | {
|
|---|
| 19 | namespace sandbox
|
|---|
| 20 | {
|
|---|
| 21 | struct joint_like
|
|---|
| 22 | {
|
|---|
| 23 | int m0;
|
|---|
| 24 | int m1;
|
|---|
| 25 | joint_like(int a0, int a1)
|
|---|
| 26 | : m0(a0)
|
|---|
| 27 | , m1(a1)
|
|---|
| 28 | {}
|
|---|
| 29 | };
|
|---|
| 30 |
|
|---|
| 31 | void run(void)
|
|---|
| 32 | {
|
|---|
| 33 | typedef list<> seq_t0;
|
|---|
| 34 | seq_t0 seq_v0;
|
|---|
| 35 | std::cout<<"size(seq_v0)="<<size(seq_v0)<<"\n";
|
|---|
| 36 | typedef
|
|---|
| 37 | #if 1
|
|---|
| 38 | result_of::push_back<seq_t0,int>::type
|
|---|
| 39 | #else
|
|---|
| 40 | list<int>
|
|---|
| 41 | #endif
|
|---|
| 42 | seq_t1;
|
|---|
| 43 | #if 1
|
|---|
| 44 | seq_t1
|
|---|
| 45 | #else
|
|---|
| 46 | auto
|
|---|
| 47 | #endif
|
|---|
| 48 | seq_v1(push_back(seq_v0,int(1)));
|
|---|
| 49 | std::cout<<"seq_v1="<<seq_v1<<"\n";
|
|---|
| 50 | std::cout<<"typeid(seq_v1)="<<typeid(seq_v1).name()<<"\n";
|
|---|
| 51 | joint_like j0(2,3);
|
|---|
| 52 | joint_like j1(j0);
|
|---|
| 53 | std::cout<<"j1.m0="<<j1.m0<<"\n";
|
|---|
| 54 | }
|
|---|
| 55 | }//exit sandbox
|
|---|
| 56 | }//exit fusion
|
|---|
| 57 | }//exit boost
|
|---|
| 58 | int main(void)
|
|---|
| 59 | {
|
|---|
| 60 | boost::fusion::sandbox::run();
|
|---|
| 61 | return 0;
|
|---|
| 62 | }
|
|---|
| 63 |
|
|---|