1 // Copyright Daniel Wallin 2006. 2 // Distributed under the Boost Software License, Version 1.0. 3 // (See accompanying file LICENSE_1_0.txt or copy at 4 // http://www.boost.org/LICENSE_1_0.txt) 5 6 #ifndef BOOST_PARAMETER_SET_060912_HPP 7 #define BOOST_PARAMETER_SET_060912_HPP 8 9 #include <boost/parameter/config.hpp> 10 11 #if defined(BOOST_PARAMETER_CAN_USE_MP11) 12 #include <boost/mp11/list.hpp> 13 14 namespace boost { namespace parameter { namespace aux { 15 16 typedef ::boost::mp11::mp_list<> set0; 17 }}} // namespace boost::parameter::aux 18 19 #include <boost/mp11/algorithm.hpp> 20 21 namespace boost { namespace parameter { namespace aux { 22 23 template <typename S, typename K> 24 struct insert_ 25 { 26 using type = ::boost::mp11::mp_insert_c<S,0,K>; 27 }; 28 }}} // namespace boost::parameter::aux 29 30 #include <boost/mp11/integral.hpp> 31 #include <boost/mp11/utility.hpp> 32 #include <type_traits> 33 34 namespace boost { namespace parameter { namespace aux { 35 36 template <typename Set, typename K> 37 struct has_key_ 38 { 39 using type = ::boost::mp11::mp_if< 40 ::boost::mp11::mp_empty<Set> 41 , ::boost::mp11::mp_false 42 , ::std::is_same< 43 ::boost::mp11::mp_find<Set,K> 44 , ::boost::mp11::mp_size<Set> 45 > 46 >; 47 }; 48 }}} // namespace boost::parameter::aux 49 50 #elif BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) 51 #include <boost/mpl/list.hpp> 52 53 namespace boost { namespace parameter { namespace aux { 54 55 typedef ::boost::mpl::list0<> set0; 56 }}} // namespace boost::parameter::aux 57 58 #include <boost/mpl/push_front.hpp> 59 60 namespace boost { namespace parameter { namespace aux { 61 62 template <typename Set, typename K> 63 struct insert_ : ::boost::mpl::push_front<Set,K> 64 { 65 }; 66 }}} // namespace boost::parameter::aux 67 68 #include <boost/mpl/bool.hpp> 69 #include <boost/mpl/if.hpp> 70 #include <boost/mpl/end.hpp> 71 #include <boost/mpl/find.hpp> 72 #include <boost/type_traits/is_same.hpp> 73 74 namespace boost { namespace parameter { namespace aux { 75 76 template <typename Set, typename K> 77 struct has_key_ 78 { 79 typedef typename ::boost::mpl::find<Set,K>::type iter; 80 typedef typename ::boost::mpl::if_< 81 ::boost::is_same<iter,typename ::boost::mpl::end<Set>::type> 82 , ::boost::mpl::false_ 83 , ::boost::mpl::true_ 84 >::type type; 85 }; 86 }}} // namespace boost::parameter::aux 87 88 #else // !BOOST_PARAMETER_CAN_USE_MP11 && Borland workarounds not needed 89 #include <boost/mpl/set/set0.hpp> 90 91 namespace boost { namespace parameter { namespace aux { 92 93 typedef ::boost::mpl::set0<> set0; 94 }}} // namespace boost::parameter::aux 95 96 #include <boost/mpl/insert.hpp> 97 98 namespace boost { namespace parameter { namespace aux { 99 100 template <typename Set, typename K> 101 struct insert_ : ::boost::mpl::insert<Set,K> 102 { 103 }; 104 }}} // namespace boost::parameter::aux 105 106 #include <boost/mpl/has_key.hpp> 107 108 namespace boost { namespace parameter { namespace aux { 109 110 template <typename Set, typename K> 111 struct has_key_ : ::boost::mpl::has_key<Set,K> 112 { 113 }; 114 }}} // namespace boost::parameter::aux 115 116 #endif // BOOST_PARAMETER_CAN_USE_MP11 || Borland workarounds needed 117 #endif // include guard 118 119