// Copyright David Abrahams 2006. // Copyright Cromwell D. Enage 2019. // 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 #include #include #include "basics.hpp" #if defined(BOOST_PARAMETER_CAN_USE_MP11) #include #include #include #include #endif namespace test { #if defined(BOOST_PARAMETER_CAN_USE_MP11) template struct assert_in_map { template void operator()(T&&) { static_assert( boost::mp11::mp_map_contains::value , "T must be in Map" ); } }; template struct assert_in_set_0 { template void operator()(T&&) { static_assert( boost::mp11::mp_contains::value , "T must be in Set" ); } }; #endif template struct assert_in_set_1 { template void operator()(T*) { BOOST_MPL_ASSERT((boost::mpl::contains)); } }; template void f_impl(Args const& p BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Expected)) { #if defined(BOOST_PARAMETER_CAN_USE_MP11) static_assert( boost::mp11::mp_size::value == boost::mp11::mp_size< Args >::value , "mp_size::value == mp_size::value" ); boost::mp11::mp_for_each >( test::assert_in_set_0() ); boost::mp11::mp_for_each(test::assert_in_map()); #endif BOOST_MPL_ASSERT_RELATION( boost::mpl::size::value , == , boost::mpl::size::value ); boost::mpl::for_each >( test::assert_in_set_1() ); boost::mpl::for_each >( test::assert_in_set_1() ); } template < typename Expected , typename Tester , typename Name , typename Value , typename Index > void f( Tester const& t , Name const& name_ , Value const& value_ , Index const& index_ BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Expected) ) { test::f_impl( test::f_parameters()(t, name_, value_, index_) ); } template < typename Expected , typename Tester , typename Name , typename Value > void f( Tester const& t , Name const& name_ , Value const& value_ BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Expected) ) { test::f_impl(test::f_parameters()(t, name_, value_)); } template void f( Tester const& t , Name const& name_ BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Expected) ) { test::f_impl(test::f_parameters()(t, name_)); } void run() { typedef test::tag::tester tester_; typedef test::tag::name name_; typedef test::tag::value value_; typedef test::tag::index index_; #if defined(BOOST_PARAMETER_CAN_USE_MP11) test::f< boost::mp11::mp_list >(1, 2, 3, 4); test::f< boost::mp11::mp_list >(1, 2, test::_index = 3); test::f< boost::mp11::mp_list >(1, test::_index = 2, test::_name = 3); test::f< boost::mp11::mp_list >(test::_name = 3, test::_value = 4); test::f_impl >(test::_value = 4); #endif test::f >(1, 2, 3, 4); test::f< boost::mpl::list3 >(1, 2, test::_index = 3); test::f< boost::mpl::list3 >(1, test::_index = 2, test::_name = 3); test::f< boost::mpl::list2 >(test::_name = 3, test::_value = 4); test::f_impl >(test::_value = 4); } } #include int main() { test::run(); return boost::report_errors(); }