Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:41:43

0001 
0002 #ifndef BOOST_MPL_MULTISET_AUX_ITEM_HPP_INCLUDED
0003 #define BOOST_MPL_MULTISET_AUX_ITEM_HPP_INCLUDED
0004 
0005 // Copyright Aleksey Gurtovoy 2003-2004
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. 
0008 // (See accompanying file LICENSE_1_0.txt or copy at 
0009 // http://www.boost.org/LICENSE_1_0.txt)
0010 //
0011 // See http://www.boost.org/libs/mpl for documentation.
0012 
0013 // $Id$
0014 // $Date$
0015 // $Revision$
0016 
0017 #include <boost/mpl/multiset/aux_/tag.hpp>
0018 #include <boost/mpl/int.hpp>
0019 #include <boost/mpl/aux_/type_wrapper.hpp>
0020 #include <boost/mpl/aux_/yes_no.hpp>
0021 #include <boost/mpl/aux_/value_wknd.hpp>
0022 #include <boost/mpl/aux_/static_cast.hpp>
0023 #include <boost/mpl/aux_/config/arrays.hpp>
0024 #include <boost/mpl/aux_/config/msvc.hpp>
0025 #include <boost/mpl/aux_/config/workaround.hpp>
0026 
0027 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
0028 #   include <boost/mpl/eval_if.hpp>
0029 #   include <boost/mpl/next.hpp>
0030 #   include <boost/type_traits/is_same.hpp>
0031 #endif
0032 
0033 
0034 namespace boost { namespace mpl {
0035 
0036 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
0037 
0038 template< typename T, typename Base >
0039 struct ms_item
0040 {
0041     typedef aux::multiset_tag tag;
0042 
0043     template< typename U > struct prior_count
0044     {
0045         enum { msvc70_wknd_ = sizeof(Base::key_count(BOOST_MPL_AUX_STATIC_CAST(U*,0))) };
0046         typedef int_< msvc70_wknd_ > count_;
0047         typedef typename eval_if< is_same<T,U>, next<count_>, count_ >::type c_;
0048 #if defined(BOOST_MPL_CFG_NO_DEPENDENT_ARRAY_TYPES)
0049         typedef typename aux::weighted_tag<BOOST_MPL_AUX_MSVC_VALUE_WKND(c_)::value>::type type;
0050 #else
0051         typedef char (&type)[BOOST_MPL_AUX_MSVC_VALUE_WKND(c_)::value];
0052 #endif
0053     };
0054 
0055     template< typename U > struct prior_ref_count
0056     {
0057         typedef U (* u_)();
0058         enum { msvc70_wknd_ = sizeof(Base::ref_key_count(BOOST_MPL_AUX_STATIC_CAST(u_,0))) }; 
0059         typedef int_< msvc70_wknd_ > count_;
0060         typedef typename eval_if< is_same<T,U>, next<count_>, count_ >::type c_;
0061 #if defined(BOOST_MPL_CFG_NO_DEPENDENT_ARRAY_TYPES)
0062         typedef typename aux::weighted_tag<BOOST_MPL_AUX_MSVC_VALUE_WKND(c_)::value>::type type;
0063 #else
0064         typedef char (&type)[BOOST_MPL_AUX_MSVC_VALUE_WKND(c_)::value];
0065 #endif
0066     };
0067 
0068     template< typename U >
0069     static typename prior_count<U>::type key_count(U*);
0070 
0071     template< typename U >
0072     static typename prior_ref_count<U>::type ref_key_count(U (*)());
0073 };
0074 
0075 #else // BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
0076 
0077 namespace aux {
0078 template< typename U, typename Base >
0079 struct prior_key_count
0080 {
0081     enum { msvc71_wknd_ = sizeof(Base::key_count(BOOST_MPL_AUX_STATIC_CAST(aux::type_wrapper<U>*,0))) }; 
0082     typedef int_< msvc71_wknd_ > count_;
0083 #if defined(BOOST_MPL_CFG_NO_DEPENDENT_ARRAY_TYPES)
0084     typedef typename aux::weighted_tag< BOOST_MPL_AUX_VALUE_WKND(count_)::value >::type type;
0085 #else
0086     typedef char (&type)[count_::value];
0087 #endif
0088 };
0089 }
0090 
0091 template< typename T, typename Base >
0092 struct ms_item
0093 {
0094     typedef aux::multiset_tag tag;
0095 
0096     enum { msvc71_wknd_ = sizeof(Base::key_count(BOOST_MPL_AUX_STATIC_CAST(aux::type_wrapper<T>*,0))) + 1 };
0097     typedef int_< msvc71_wknd_ > count_;
0098 #if defined(BOOST_MPL_CFG_NO_DEPENDENT_ARRAY_TYPES)
0099     static 
0100     typename aux::weighted_tag< BOOST_MPL_AUX_VALUE_WKND(count_)::value >::type
0101         key_count(aux::type_wrapper<T>*);
0102 #else
0103     static char (& key_count(aux::type_wrapper<T>*) )[count_::value];
0104 #endif
0105 
0106     template< typename U >
0107     static typename aux::prior_key_count<U,Base>::type key_count(aux::type_wrapper<U>*);
0108 };
0109 
0110 #endif // BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
0111 
0112 }}
0113 
0114 #endif // BOOST_MPL_MULTISET_AUX_ITEM_HPP_INCLUDED