File indexing completed on 2025-01-18 09:41:43
0001
0002 #ifndef BOOST_MPL_MULTISET_AUX_COUNT_IMPL_HPP_INCLUDED
0003 #define BOOST_MPL_MULTISET_AUX_COUNT_IMPL_HPP_INCLUDED
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #include <boost/mpl/multiset/aux_/tag.hpp>
0018 #include <boost/mpl/count_fwd.hpp>
0019 #include <boost/mpl/int.hpp>
0020 #include <boost/mpl/aux_/type_wrapper.hpp>
0021 #include <boost/mpl/aux_/static_cast.hpp>
0022 #include <boost/mpl/aux_/config/static_constant.hpp>
0023 #include <boost/mpl/aux_/config/workaround.hpp>
0024 #include <boost/mpl/aux_/config/msvc.hpp>
0025
0026 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
0027 # include <boost/mpl/if.hpp>
0028 # include <boost/type_traits/is_reference.hpp>
0029 #endif
0030
0031 namespace boost { namespace mpl {
0032
0033 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
0034
0035 namespace aux {
0036 template< typename S, typename U >
0037 struct multiset_count_impl
0038 : int_< sizeof(S::key_count(BOOST_MPL_AUX_STATIC_CAST(U*,0))) - 1 >
0039 {
0040 };
0041
0042 template< typename S, typename U >
0043 struct multiset_count_ref_impl
0044 {
0045 typedef U (* u_)();
0046 typedef int_< sizeof(S::ref_key_count(BOOST_MPL_AUX_STATIC_CAST(u_,0))) - 1 > type_;
0047 BOOST_STATIC_CONSTANT(int, value = type_::value);
0048 typedef type_ type;
0049 };
0050 }
0051
0052 template<>
0053 struct count_impl< aux::multiset_tag >
0054 {
0055 template< typename Set, typename Key > struct apply
0056 : if_<
0057 is_reference<Key>
0058 , aux::multiset_count_ref_impl<Set,Key>
0059 , aux::multiset_count_impl<Set,Key>
0060 >::type
0061 {
0062 };
0063 };
0064
0065 #else
0066
0067 template<>
0068 struct count_impl< aux::multiset_tag >
0069 {
0070 template< typename Set, typename Key > struct apply
0071 {
0072 enum { msvc71_wknd_ = sizeof(Set::key_count(BOOST_MPL_AUX_STATIC_CAST(aux::type_wrapper<Key>*,0))) - 1 };
0073 typedef int_< msvc71_wknd_ > type;
0074 BOOST_STATIC_CONSTANT(int, value = msvc71_wknd_);
0075 };
0076 };
0077
0078 #endif
0079
0080 }}
0081
0082 #endif