Chris@16
|
1
|
Chris@16
|
2 #ifndef BOOST_MPL_MULTISET_AUX_ITEM_HPP_INCLUDED
|
Chris@16
|
3 #define BOOST_MPL_MULTISET_AUX_ITEM_HPP_INCLUDED
|
Chris@16
|
4
|
Chris@16
|
5 // Copyright Aleksey Gurtovoy 2003-2004
|
Chris@16
|
6 //
|
Chris@16
|
7 // Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
8 // (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
9 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
10 //
|
Chris@16
|
11 // See http://www.boost.org/libs/mpl for documentation.
|
Chris@16
|
12
|
Chris@101
|
13 // $Id$
|
Chris@101
|
14 // $Date$
|
Chris@101
|
15 // $Revision$
|
Chris@16
|
16
|
Chris@16
|
17 #include <boost/mpl/multiset/aux_/tag.hpp>
|
Chris@16
|
18 #include <boost/mpl/int.hpp>
|
Chris@16
|
19 #include <boost/mpl/aux_/type_wrapper.hpp>
|
Chris@16
|
20 #include <boost/mpl/aux_/yes_no.hpp>
|
Chris@16
|
21 #include <boost/mpl/aux_/value_wknd.hpp>
|
Chris@16
|
22 #include <boost/mpl/aux_/static_cast.hpp>
|
Chris@16
|
23 #include <boost/mpl/aux_/config/arrays.hpp>
|
Chris@16
|
24 #include <boost/mpl/aux_/config/msvc.hpp>
|
Chris@16
|
25 #include <boost/mpl/aux_/config/workaround.hpp>
|
Chris@16
|
26
|
Chris@16
|
27 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
Chris@16
|
28 # include <boost/mpl/eval_if.hpp>
|
Chris@16
|
29 # include <boost/mpl/next.hpp>
|
Chris@16
|
30 # include <boost/type_traits/is_same.hpp>
|
Chris@16
|
31 #endif
|
Chris@16
|
32
|
Chris@16
|
33
|
Chris@16
|
34 namespace boost { namespace mpl {
|
Chris@16
|
35
|
Chris@16
|
36 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
Chris@16
|
37
|
Chris@16
|
38 template< typename T, typename Base >
|
Chris@16
|
39 struct ms_item
|
Chris@16
|
40 {
|
Chris@16
|
41 typedef aux::multiset_tag tag;
|
Chris@16
|
42
|
Chris@16
|
43 template< typename U > struct prior_count
|
Chris@16
|
44 {
|
Chris@16
|
45 enum { msvc70_wknd_ = sizeof(Base::key_count(BOOST_MPL_AUX_STATIC_CAST(U*,0))) };
|
Chris@16
|
46 typedef int_< msvc70_wknd_ > count_;
|
Chris@16
|
47 typedef typename eval_if< is_same<T,U>, next<count_>, count_ >::type c_;
|
Chris@16
|
48 #if defined(BOOST_MPL_CFG_NO_DEPENDENT_ARRAY_TYPES)
|
Chris@16
|
49 typedef typename aux::weighted_tag<BOOST_MPL_AUX_MSVC_VALUE_WKND(c_)::value>::type type;
|
Chris@16
|
50 #else
|
Chris@16
|
51 typedef char (&type)[BOOST_MPL_AUX_MSVC_VALUE_WKND(c_)::value];
|
Chris@16
|
52 #endif
|
Chris@16
|
53 };
|
Chris@16
|
54
|
Chris@16
|
55 template< typename U > struct prior_ref_count
|
Chris@16
|
56 {
|
Chris@16
|
57 typedef U (* u_)();
|
Chris@16
|
58 enum { msvc70_wknd_ = sizeof(Base::ref_key_count(BOOST_MPL_AUX_STATIC_CAST(u_,0))) };
|
Chris@16
|
59 typedef int_< msvc70_wknd_ > count_;
|
Chris@16
|
60 typedef typename eval_if< is_same<T,U>, next<count_>, count_ >::type c_;
|
Chris@16
|
61 #if defined(BOOST_MPL_CFG_NO_DEPENDENT_ARRAY_TYPES)
|
Chris@16
|
62 typedef typename aux::weighted_tag<BOOST_MPL_AUX_MSVC_VALUE_WKND(c_)::value>::type type;
|
Chris@16
|
63 #else
|
Chris@16
|
64 typedef char (&type)[BOOST_MPL_AUX_MSVC_VALUE_WKND(c_)::value];
|
Chris@16
|
65 #endif
|
Chris@16
|
66 };
|
Chris@16
|
67
|
Chris@16
|
68 template< typename U >
|
Chris@16
|
69 static typename prior_count<U>::type key_count(U*);
|
Chris@16
|
70
|
Chris@16
|
71 template< typename U >
|
Chris@16
|
72 static typename prior_ref_count<U>::type ref_key_count(U (*)());
|
Chris@16
|
73 };
|
Chris@16
|
74
|
Chris@16
|
75 #else // BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
Chris@16
|
76
|
Chris@16
|
77 namespace aux {
|
Chris@16
|
78 template< typename U, typename Base >
|
Chris@16
|
79 struct prior_key_count
|
Chris@16
|
80 {
|
Chris@16
|
81 enum { msvc71_wknd_ = sizeof(Base::key_count(BOOST_MPL_AUX_STATIC_CAST(aux::type_wrapper<U>*,0))) };
|
Chris@16
|
82 typedef int_< msvc71_wknd_ > count_;
|
Chris@16
|
83 #if defined(BOOST_MPL_CFG_NO_DEPENDENT_ARRAY_TYPES)
|
Chris@16
|
84 typedef typename aux::weighted_tag< BOOST_MPL_AUX_VALUE_WKND(count_)::value >::type type;
|
Chris@16
|
85 #else
|
Chris@16
|
86 typedef char (&type)[count_::value];
|
Chris@16
|
87 #endif
|
Chris@16
|
88 };
|
Chris@16
|
89 }
|
Chris@16
|
90
|
Chris@16
|
91 template< typename T, typename Base >
|
Chris@16
|
92 struct ms_item
|
Chris@16
|
93 {
|
Chris@16
|
94 typedef aux::multiset_tag tag;
|
Chris@16
|
95
|
Chris@16
|
96 enum { msvc71_wknd_ = sizeof(Base::key_count(BOOST_MPL_AUX_STATIC_CAST(aux::type_wrapper<T>*,0))) + 1 };
|
Chris@16
|
97 typedef int_< msvc71_wknd_ > count_;
|
Chris@16
|
98 #if defined(BOOST_MPL_CFG_NO_DEPENDENT_ARRAY_TYPES)
|
Chris@16
|
99 static
|
Chris@16
|
100 typename aux::weighted_tag< BOOST_MPL_AUX_VALUE_WKND(count_)::value >::type
|
Chris@16
|
101 key_count(aux::type_wrapper<T>*);
|
Chris@16
|
102 #else
|
Chris@16
|
103 static char (& key_count(aux::type_wrapper<T>*) )[count_::value];
|
Chris@16
|
104 #endif
|
Chris@16
|
105
|
Chris@16
|
106 template< typename U >
|
Chris@16
|
107 static typename aux::prior_key_count<U,Base>::type key_count(aux::type_wrapper<U>*);
|
Chris@16
|
108 };
|
Chris@16
|
109
|
Chris@16
|
110 #endif // BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
Chris@16
|
111
|
Chris@16
|
112 }}
|
Chris@16
|
113
|
Chris@16
|
114 #endif // BOOST_MPL_MULTISET_AUX_ITEM_HPP_INCLUDED
|