/*============================================================================= Copyright (c) 2001-2007 Joel de Guzman 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 using namespace boost::phoenix; using namespace boost::phoenix::arg_names; using namespace std; struct X { template < typename Env , typename A0 = void_ , typename A1 = void_ , typename A2 = void_ > struct result { typedef int type; }; template static RT eval(Env const& env, A0& a0, A1& a1, A2& a2) { return a0.eval(env) + a1.eval(env) + a2.eval(env); } }; int main() { using boost::fusion::at_c; { // testing as_actor BOOST_STATIC_ASSERT((boost::is_same< as_actor > >::type, actor > >::value)); BOOST_STATIC_ASSERT((boost::is_same< as_actor::type, actor > >::value)); } { // testing compose char const* s = "Hi"; int x = 123; BOOST_TEST(at_c<0>(compose(1, arg1, val(1))) .eval(basic_environment<>()) == 1); BOOST_TEST(at_c<1>(compose(1, arg1, val(456))) .eval(basic_environment(s)) == s); BOOST_TEST(at_c<2>(compose(1, arg1, val(456))) .eval(basic_environment<>()) == 456); BOOST_TEST(compose(9876, arg1, val(456)) .eval(basic_environment(x)) == 10455); // testing composite sizes cout << "sizeof(arg1) is: " << sizeof(arg1) << endl; cout << "sizeof(compose(arg1)) is: " << sizeof(compose(arg1)) << endl; cout << "sizeof(compose(1, arg1, val(456))) is: " << sizeof(compose(1, arg1, val(456))) << endl; cout << "sizeof(compose()) is: " << sizeof(compose()) << endl; cout << "sizeof(compose('x')) is: " << sizeof(compose('x')) << endl; cout << "sizeof(compose('x', 3)) is: " << sizeof(compose('x', 3)) << endl; cout << "sizeof(compose('x', 'y', 3)) is: " << sizeof(compose('x', 'y', 3)) << endl; } return boost::report_errors(); }