/////////////////////////////////////////////////////////////////////////////// // mpl.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) #include #include #include #include #include #include namespace mpl = boost::mpl; namespace proto = boost::proto; namespace fusion = boost::fusion; using proto::_; template struct my_expr; struct my_domain : proto::domain > {}; template struct my_expr : proto::extends, my_domain> { my_expr(E const &e = E()) : proto::extends, my_domain>(e) {} typedef fusion::fusion_sequence_tag tag; }; template void test_impl(T const &) { typedef typename mpl::pop_back::type result_type; BOOST_STATIC_ASSERT( (boost::is_same< result_type , my_expr::type>&> > > >::value) ); } // Test that we can call mpl algorithms on proto expression types, and get proto expression types back void test_mpl() { my_expr::type> i; test_impl(i + i); } using namespace boost::unit_test; /////////////////////////////////////////////////////////////////////////////// // init_unit_test_suite // test_suite* init_unit_test_suite( int argc, char* argv[] ) { test_suite *test = BOOST_TEST_SUITE("test proto mpl integration via fusion"); test->add(BOOST_TEST_CASE(&test_mpl)); return test; }