/////////////////////////////////////////////////////////////////////////////// // deduce_domain.hpp // // Copyright 2008 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 // Avoid a compile-time check inside the deduce_domain code. #define BOOST_PROTO_ASSERT_VALID_DOMAIN(DOM) typedef DOM DOM ## _ #include #include #include #include namespace proto = boost::proto; using proto::_; struct D0 : proto::domain<> { }; struct D1 : proto::domain { }; struct D2 : proto::domain { }; struct D3 : proto::domain<> { }; struct DD0 : proto::domain { }; struct DD1 : proto::domain { }; struct DD2 : proto::domain { }; struct DD3 : proto::domain { }; struct DD4 : proto::domain { }; BOOST_AUTO_TEST_CASE(test1) { using boost::is_same; //* BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, proto::default_domain>)); BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, DD0>)); BOOST_MPL_ASSERT((is_same::type, DD0>)); BOOST_MPL_ASSERT((is_same::type, DD0>)); BOOST_MPL_ASSERT((is_same::type, DD0>)); BOOST_MPL_ASSERT((is_same::type, DD0>)); BOOST_MPL_ASSERT((is_same::type, DD0>)); BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, D1>)); // Very tricky to get right BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, D0>)); BOOST_MPL_ASSERT((is_same::type, D1>)); BOOST_MPL_ASSERT((is_same::type, proto::detail::not_a_domain>)); BOOST_MPL_ASSERT((is_same::type, proto::detail::not_a_domain>)); BOOST_MPL_ASSERT((is_same::type, proto::detail::not_a_domain>)); BOOST_MPL_ASSERT((is_same::type, proto::detail::not_a_domain>)); BOOST_MPL_ASSERT((is_same::type, proto::detail::not_a_domain>)); BOOST_MPL_ASSERT((is_same::type, proto::detail::not_a_domain>)); BOOST_MPL_ASSERT((is_same::type, proto::detail::not_a_domain>)); BOOST_MPL_ASSERT((is_same::type, proto::detail::not_a_domain>)); BOOST_MPL_ASSERT((is_same::type, proto::detail::not_a_domain>)); BOOST_MPL_ASSERT((is_same::type, proto::detail::not_a_domain>)); BOOST_MPL_ASSERT((is_same::type, proto::detail::not_a_domain>)); BOOST_MPL_ASSERT((is_same::type, proto::detail::not_a_domain>)); BOOST_MPL_ASSERT((is_same::type, proto::detail::not_a_domain>)); BOOST_MPL_ASSERT((is_same::type, proto::detail::not_a_domain>)); BOOST_MPL_ASSERT((is_same::type, proto::detail::not_a_domain>)); // These should be ambiguous. BOOST_MPL_ASSERT((is_same::type, proto::detail::not_a_domain>)); BOOST_MPL_ASSERT((is_same::type, proto::detail::not_a_domain>)); BOOST_MPL_ASSERT((is_same::type, proto::detail::not_a_domain>)); BOOST_MPL_ASSERT((is_same::type, DD2>)); BOOST_MPL_ASSERT((is_same::type, DD2>)); BOOST_MPL_ASSERT((is_same::type, DD2>)); BOOST_MPL_ASSERT((is_same::type, DD2>)); BOOST_MPL_ASSERT((is_same::type, DD2>)); BOOST_MPL_ASSERT((is_same::type, DD2>)); //*/ }