/////////////////////////////////////////////////////////////////////////////// // protect.hpp // // Copyright 2012 Eric Niebler. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #define BOOST_TEST_MAIN #include #include #include #include #include namespace proto=boost::proto; using proto::_; template struct identity { typedef T type; }; struct TestWithMake : proto::make< proto::protect<_> > {}; struct TestWithMake1 : proto::make< identity > > {}; struct TestWithMake2 : proto::make< identity > > {}; struct TestWithMake3 : proto::make< identity > > > {}; struct TestWithMake4 : proto::make< identity > > > {}; struct TestWithMake5 : proto::make< identity > > > > {}; BOOST_AUTO_TEST_CASE(test_protect_with_make) { proto::terminal::type i = {42}; _ t = TestWithMake()(i); _ t1 = TestWithMake1()(i); int t2 = TestWithMake2()(i); identity<_> t3 = TestWithMake3()(i); identity t4 = TestWithMake4()(i); identity > t5 = TestWithMake5()(i); } //struct TestWithWhen // : proto::when<_, proto::protect<_>() > //{}; struct TestWithWhen1 : proto::when<_, identity >() > {}; struct TestWithWhen2 : proto::when<_, identity >() > {}; struct TestWithWhen3 : proto::when<_, identity > >() > {}; struct TestWithWhen4 : proto::when<_, identity > >() > {}; struct TestWithWhen5 : proto::when<_, identity > > >() > {}; BOOST_AUTO_TEST_CASE(test_protect_with_when) { proto::terminal::type i = {42}; //_ t = TestWithWhen()(i); _ t1 = TestWithWhen1()(i); int t2 = TestWithWhen2()(i); identity<_> t3 = TestWithWhen3()(i); identity t4 = TestWithWhen4()(i); identity > t5 = TestWithWhen5()(i); }