2 #ifndef BOOST_MPL_MULTISET_AUX_ITEM_HPP_INCLUDED
\r
3 #define BOOST_MPL_MULTISET_AUX_ITEM_HPP_INCLUDED
\r
5 // Copyright Aleksey Gurtovoy 2003-2004
\r
7 // Distributed under the Boost Software License, Version 1.0.
\r
8 // (See accompanying file LICENSE_1_0.txt or copy at
\r
9 // http://www.boost.org/LICENSE_1_0.txt)
\r
11 // See http://www.boost.org/libs/mpl for documentation.
\r
13 // $Id: item.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
\r
14 // $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
\r
15 // $Revision: 49267 $
\r
17 #include <boost/mpl/multiset/aux_/tag.hpp>
\r
18 #include <boost/mpl/int.hpp>
\r
19 #include <boost/mpl/aux_/type_wrapper.hpp>
\r
20 #include <boost/mpl/aux_/yes_no.hpp>
\r
21 #include <boost/mpl/aux_/value_wknd.hpp>
\r
22 #include <boost/mpl/aux_/static_cast.hpp>
\r
23 #include <boost/mpl/aux_/config/arrays.hpp>
\r
24 #include <boost/mpl/aux_/config/msvc.hpp>
\r
25 #include <boost/mpl/aux_/config/workaround.hpp>
\r
27 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
\r
28 # include <boost/mpl/eval_if.hpp>
\r
29 # include <boost/mpl/next.hpp>
\r
30 # include <boost/type_traits/is_same.hpp>
\r
34 namespace boost { namespace mpl {
\r
36 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
\r
38 template< typename T, typename Base >
\r
41 typedef aux::multiset_tag tag;
\r
43 template< typename U > struct prior_count
\r
45 enum { msvc70_wknd_ = sizeof(Base::key_count(BOOST_MPL_AUX_STATIC_CAST(U*,0))) };
\r
46 typedef int_< msvc70_wknd_ > count_;
\r
47 typedef typename eval_if< is_same<T,U>, next<count_>, count_ >::type c_;
\r
48 #if defined(BOOST_MPL_CFG_NO_DEPENDENT_ARRAY_TYPES)
\r
49 typedef typename aux::weighted_tag<BOOST_MPL_AUX_MSVC_VALUE_WKND(c_)::value>::type type;
\r
51 typedef char (&type)[BOOST_MPL_AUX_MSVC_VALUE_WKND(c_)::value];
\r
55 template< typename U > struct prior_ref_count
\r
58 enum { msvc70_wknd_ = sizeof(Base::ref_key_count(BOOST_MPL_AUX_STATIC_CAST(u_,0))) };
\r
59 typedef int_< msvc70_wknd_ > count_;
\r
60 typedef typename eval_if< is_same<T,U>, next<count_>, count_ >::type c_;
\r
61 #if defined(BOOST_MPL_CFG_NO_DEPENDENT_ARRAY_TYPES)
\r
62 typedef typename aux::weighted_tag<BOOST_MPL_AUX_MSVC_VALUE_WKND(c_)::value>::type type;
\r
64 typedef char (&type)[BOOST_MPL_AUX_MSVC_VALUE_WKND(c_)::value];
\r
68 template< typename U >
\r
69 static typename prior_count<U>::type key_count(U*);
\r
71 template< typename U >
\r
72 static typename prior_ref_count<U>::type ref_key_count(U (*)());
\r
75 #else // BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
\r
78 template< typename U, typename Base >
\r
79 struct prior_key_count
\r
81 enum { msvc71_wknd_ = sizeof(Base::key_count(BOOST_MPL_AUX_STATIC_CAST(aux::type_wrapper<U>*,0))) };
\r
82 typedef int_< msvc71_wknd_ > count_;
\r
83 #if defined(BOOST_MPL_CFG_NO_DEPENDENT_ARRAY_TYPES)
\r
84 typedef typename aux::weighted_tag< BOOST_MPL_AUX_VALUE_WKND(count_)::value >::type type;
\r
86 typedef char (&type)[count_::value];
\r
91 template< typename T, typename Base >
\r
94 typedef aux::multiset_tag tag;
\r
96 enum { msvc71_wknd_ = sizeof(Base::key_count(BOOST_MPL_AUX_STATIC_CAST(aux::type_wrapper<T>*,0))) + 1 };
\r
97 typedef int_< msvc71_wknd_ > count_;
\r
98 #if defined(BOOST_MPL_CFG_NO_DEPENDENT_ARRAY_TYPES)
\r
100 typename aux::weighted_tag< BOOST_MPL_AUX_VALUE_WKND(count_)::value >::type
\r
101 key_count(aux::type_wrapper<T>*);
\r
103 static char (& key_count(aux::type_wrapper<T>*) )[count_::value];
\r
106 template< typename U >
\r
107 static typename aux::prior_key_count<U,Base>::type key_count(aux::type_wrapper<U>*);
\r
110 #endif // BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
\r
114 #endif // BOOST_MPL_MULTISET_AUX_ITEM_HPP_INCLUDED
\r