// Copyright Daniel Wallin 2005. // 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) namespace test { struct default_src { typedef int result_type; int operator()() const { return 0; } }; } // namespace test #include namespace test { BOOST_PARAMETER_NAME(x) BOOST_PARAMETER_NAME(y) } // namespace test #include #include namespace test { template void check0(ArgumentPack const& p, K const& kw, T const& value) { BOOST_MPL_ASSERT((boost::parameter::is_argument_pack)); BOOST_TEST_EQ(p[kw], value); } } // namespace test #include #include #include #include #include #include #include #include #include #include namespace test { template void check1(ArgumentPack const& p, K const& kw, T const& value) { BOOST_MPL_ASSERT((boost::parameter::is_argument_pack)); BOOST_MPL_ASSERT((boost::mpl::has_key)); BOOST_MPL_ASSERT(( boost::mpl::equal_to< typename boost::mpl::count::type , boost::mpl::int_<1> > )); BOOST_MPL_ASSERT(( typename boost::mpl::if_< boost::is_same< typename boost::mpl ::key_type::type , typename K::tag > , boost::mpl::true_ , boost::mpl::false_ >::type )); BOOST_MPL_ASSERT(( typename boost::mpl::if_< boost::is_same< typename boost::mpl ::order::type , boost::mpl::void_ > , boost::mpl::false_ , boost::mpl::true_ >::type )); BOOST_TEST_EQ(p[kw], value); } } // namespace test int main() { test::check1(test::_x = 20, test::_x, 20); test::check1(test::_y = 20, test::_y, 20); test::check0(test::_x = 20, test::_x | 0, 20); test::check0(test::_y = 20, test::_y | 0, 20); test::check0(test::_x = 20, test::_x || test::default_src(), 20); test::check0(test::_y = 20, test::_y || test::default_src(), 20); test::check0(test::_y = 20, test::_x | 0, 0); test::check0(test::_y = 20, test::_x || test::default_src(), 0); return boost::report_errors(); }