mirror of
https://github.com/boostorg/mpl.git
synced 2025-08-03 14:54:30 +02:00
rework set/map to workaround GCC 3.4 problems
[SVN r25712]
This commit is contained in:
@@ -15,16 +15,17 @@
|
||||
// $Revision$
|
||||
|
||||
#include <boost/mpl/aux_/config/gcc.hpp>
|
||||
#include <boost/mpl/aux_/config/msvc.hpp>
|
||||
#include <boost/mpl/aux_/config/workaround.hpp>
|
||||
|
||||
// agurt, 03/may/03: when defining 'friend' operators, use specialization
|
||||
// in place of conventional overloading to supress a warning on GCC 3.x;
|
||||
// breaks 2.95.x!
|
||||
#if !defined(BOOST_MPL_CFG_USE_OPERATORS_SPECIALIZATION) \
|
||||
&& BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, > 0x0295) \
|
||||
&& BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, BOOST_TESTED_AT(0x0302))
|
||||
#if !defined(BOOST_MPL_CFG_USE_OPERATORS_OVERLOADING) \
|
||||
&& ( BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \
|
||||
|| BOOST_WORKAROUND(__BORLANDC__, <= 0x600) \
|
||||
|| BOOST_WORKAROUND(__EDG_VERSION__, <= 245) \
|
||||
|| BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, <= 0x0295) \
|
||||
)
|
||||
|
||||
# define BOOST_MPL_CFG_USE_OPERATORS_SPECIALIZATION
|
||||
# define BOOST_MPL_CFG_USE_OPERATORS_OVERLOADING
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -22,7 +22,6 @@
|
||||
#include <boost/mpl/aux_/overload_names.hpp>
|
||||
#include <boost/mpl/aux_/static_cast.hpp>
|
||||
#include <boost/mpl/aux_/type_wrapper.hpp>
|
||||
#include <boost/mpl/aux_/ptr_to_ref.hpp>
|
||||
#include <boost/mpl/aux_/traits_lambda_spec.hpp>
|
||||
#include <boost/mpl/aux_/config/msvc.hpp>
|
||||
#include <boost/mpl/aux_/config/static_constant.hpp>
|
||||
@@ -39,7 +38,7 @@ template< typename Seq, typename Key > struct x_order_impl
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(long, value =
|
||||
sizeof( BOOST_MPL_AUX_OVERLOAD_CALL_ORDER_BY_KEY(
|
||||
*BOOST_MPL_AUX_STATIC_CAST(Seq*, 0)
|
||||
Seq
|
||||
, BOOST_MPL_AUX_STATIC_CAST(aux::type_wrapper<Key>*, 0)
|
||||
) )
|
||||
);
|
||||
@@ -48,8 +47,8 @@ template< typename Seq, typename Key > struct x_order_impl
|
||||
|
||||
#else // ISO98 C++
|
||||
: long_<
|
||||
sizeof( BOOST_MPL_AUX_OVERLOAD_ORDER_BY_KEY(
|
||||
aux::ptr_to_ref(BOOST_MPL_AUX_STATIC_CAST(Seq*, 0))
|
||||
sizeof( BOOST_MPL_AUX_OVERLOAD_CALL_ORDER_BY_KEY(
|
||||
Seq
|
||||
, BOOST_MPL_AUX_STATIC_CAST(aux::type_wrapper<Key>*, 0)
|
||||
) )
|
||||
>
|
||||
|
@@ -14,21 +14,22 @@
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#include <boost/mpl/aux_/config/msvc.hpp>
|
||||
#include <boost/mpl/aux_/config/workaround.hpp>
|
||||
#include <boost/mpl/aux_/ptr_to_ref.hpp>
|
||||
#include <boost/mpl/aux_/config/operators.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \
|
||||
|| BOOST_WORKAROUND(__EDG_VERSION__, <= 245)
|
||||
#if defined(BOOST_MPL_CFG_USE_OPERATORS_OVERLOADING)
|
||||
|
||||
# include <boost/mpl/aux_/static_cast.hpp>
|
||||
|
||||
# define BOOST_MPL_AUX_OVERLOAD_VALUE_BY_KEY operator/
|
||||
# define BOOST_MPL_AUX_OVERLOAD_ITEM_BY_ORDER operator|
|
||||
# define BOOST_MPL_AUX_OVERLOAD_ORDER_BY_KEY operator||
|
||||
# define BOOST_MPL_AUX_OVERLOAD_IS_MASKED operator%
|
||||
|
||||
# define BOOST_MPL_AUX_OVERLOAD_CALL_VALUE_BY_KEY(x, y) x / y
|
||||
# define BOOST_MPL_AUX_OVERLOAD_CALL_ITEM_BY_ORDER(x, y) x | y
|
||||
# define BOOST_MPL_AUX_OVERLOAD_CALL_ORDER_BY_KEY(x, y) x || y
|
||||
# define BOOST_MPL_AUX_OVERLOAD_CALL_IS_MASKED(x, y) x % y
|
||||
# define BOOST_MPL_AUX_OVERLOAD_CALL_VALUE_BY_KEY(T, x) BOOST_MPL_AUX_PTR_TO_REF(T) / x
|
||||
# define BOOST_MPL_AUX_OVERLOAD_CALL_ITEM_BY_ORDER(T, x) BOOST_MPL_AUX_PTR_TO_REF(T) | x
|
||||
# define BOOST_MPL_AUX_OVERLOAD_CALL_ORDER_BY_KEY(T, x) BOOST_MPL_AUX_PTR_TO_REF(T) || x
|
||||
# define BOOST_MPL_AUX_OVERLOAD_CALL_IS_MASKED(T, x) BOOST_MPL_AUX_PTR_TO_REF(T) % x
|
||||
|
||||
#else
|
||||
|
||||
@@ -37,10 +38,10 @@
|
||||
# define BOOST_MPL_AUX_OVERLOAD_ORDER_BY_KEY order_by_key_
|
||||
# define BOOST_MPL_AUX_OVERLOAD_IS_MASKED is_masked_
|
||||
|
||||
# define BOOST_MPL_AUX_OVERLOAD_CALL_VALUE_BY_KEY BOOST_MPL_AUX_OVERLOAD_VALUE_BY_KEY
|
||||
# define BOOST_MPL_AUX_OVERLOAD_CALL_ITEM_BY_ORDER BOOST_MPL_AUX_OVERLOAD_ITEM_BY_ORDER
|
||||
# define BOOST_MPL_AUX_OVERLOAD_CALL_ORDER_BY_KEY BOOST_MPL_AUX_OVERLOAD_ORDER_BY_KEY
|
||||
# define BOOST_MPL_AUX_OVERLOAD_CALL_IS_MASKED BOOST_MPL_AUX_OVERLOAD_IS_MASKED
|
||||
# define BOOST_MPL_AUX_OVERLOAD_CALL_VALUE_BY_KEY(T, x) T::BOOST_MPL_AUX_OVERLOAD_VALUE_BY_KEY( BOOST_MPL_AUX_PTR_TO_REF(T), x )
|
||||
# define BOOST_MPL_AUX_OVERLOAD_CALL_ITEM_BY_ORDER(T, x) T::BOOST_MPL_AUX_OVERLOAD_ITEM_BY_ORDER( BOOST_MPL_AUX_PTR_TO_REF(T), x )
|
||||
# define BOOST_MPL_AUX_OVERLOAD_CALL_ORDER_BY_KEY(T, x) T::BOOST_MPL_AUX_OVERLOAD_ORDER_BY_KEY( BOOST_MPL_AUX_PTR_TO_REF(T), x )
|
||||
# define BOOST_MPL_AUX_OVERLOAD_CALL_IS_MASKED(T, x) T::BOOST_MPL_AUX_OVERLOAD_IS_MASKED( BOOST_MPL_AUX_PTR_TO_REF(T), x )
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -14,6 +14,27 @@
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#include <boost/mpl/aux_/static_cast.hpp>
|
||||
#include <boost/mpl/aux_/config/msvc.hpp>
|
||||
#include <boost/mpl/aux_/config/workaround.hpp>
|
||||
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \
|
||||
|| BOOST_WORKAROUND(__EDG_VERSION__, <= 245)
|
||||
|
||||
# define BOOST_MPL_AUX_PTR_TO_REF(X) \
|
||||
*BOOST_MPL_AUX_STATIC_CAST(X*, 0) \
|
||||
/**/
|
||||
|
||||
#else
|
||||
|
||||
# define BOOST_MPL_AUX_PTR_TO_REF(X) \
|
||||
aux::ptr_to_ref(BOOST_MPL_AUX_STATIC_CAST(X*, 0)) \
|
||||
/**/
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
namespace boost { namespace mpl { namespace aux {
|
||||
|
||||
template< typename T > static T const& ptr_to_ref(T*);
|
||||
|
@@ -41,7 +41,7 @@ struct m_at
|
||||
{
|
||||
typedef aux::type_wrapper<Key> key_;
|
||||
typedef __typeof__( BOOST_MPL_AUX_OVERLOAD_CALL_VALUE_BY_KEY(
|
||||
aux::ptr_to_ref(BOOST_MPL_AUX_STATIC_CAST(Map*, 0))
|
||||
Map
|
||||
, BOOST_MPL_AUX_STATIC_CAST(key_*, 0)
|
||||
) ) type;
|
||||
};
|
||||
@@ -63,7 +63,7 @@ template< typename Map, long order >
|
||||
struct item_by_order_impl
|
||||
{
|
||||
typedef __typeof__( BOOST_MPL_AUX_OVERLOAD_CALL_ITEM_BY_ORDER(
|
||||
aux::ptr_to_ref(BOOST_MPL_AUX_STATIC_CAST(Map*, 0))
|
||||
Map
|
||||
, BOOST_MPL_AUX_STATIC_CAST(long_<order>*, 0)
|
||||
) ) type;
|
||||
};
|
||||
@@ -101,7 +101,7 @@ template< typename Map, long order > struct is_item_masked
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
sizeof( BOOST_MPL_AUX_OVERLOAD_CALL_IS_MASKED(
|
||||
aux::ptr_to_ref(BOOST_MPL_AUX_STATIC_CAST(Map*, 0))
|
||||
Map
|
||||
, BOOST_MPL_AUX_STATIC_CAST(long_<order>*, 0)
|
||||
) ) == sizeof(aux::yes_tag)
|
||||
);
|
||||
|
@@ -22,56 +22,16 @@
|
||||
#include <boost/mpl/prior.hpp>
|
||||
#include <boost/mpl/map/aux_/map0.hpp>
|
||||
#include <boost/mpl/aux_/order_impl.hpp>
|
||||
#include <boost/mpl/aux_/overload_names.hpp>
|
||||
#include <boost/mpl/aux_/yes_no.hpp>
|
||||
#include <boost/mpl/aux_/type_wrapper.hpp>
|
||||
#include <boost/mpl/aux_/config/arrays.hpp>
|
||||
#include <boost/mpl/aux_/config/operators.hpp>
|
||||
#include <boost/mpl/aux_/config/typeof.hpp>
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
#if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
|
||||
|
||||
aux::type_wrapper<void_> BOOST_MPL_AUX_OVERLOAD_VALUE_BY_KEY( map0<> const&, void const volatile* );
|
||||
aux::type_wrapper<void_> BOOST_MPL_AUX_OVERLOAD_ITEM_BY_ORDER( map0<> const&, long_<1>* );
|
||||
aux::no_tag BOOST_MPL_AUX_OVERLOAD_ORDER_BY_KEY( map0<> const&, void const volatile* );
|
||||
|
||||
# if defined(BOOST_MPL_CFG_USE_OPERATORS_SPECIALIZATION)
|
||||
|
||||
template< typename Key, typename T, typename Base > struct m_item;
|
||||
template< typename Key, typename Base > struct m_mask;
|
||||
|
||||
template< typename Key, typename T, typename Base >
|
||||
aux::type_wrapper<T>
|
||||
BOOST_MPL_AUX_OVERLOAD_VALUE_BY_KEY( m_item<Key,T,Base> const&, aux::type_wrapper<Key>* );
|
||||
|
||||
template< typename Key, typename T, typename Base >
|
||||
aux::type_wrapper< typename m_item<Key,T,Base>::item >
|
||||
BOOST_MPL_AUX_OVERLOAD_ITEM_BY_ORDER( m_item<Key,T,Base> const&, typename m_item<Key,T,Base>::order* );
|
||||
|
||||
template< typename Key, typename Base >
|
||||
aux::type_wrapper<void_>
|
||||
BOOST_MPL_AUX_OVERLOAD_VALUE_BY_KEY( m_mask<Key,Base> const&, aux::type_wrapper<Key>* );
|
||||
|
||||
template< typename Key, typename Base >
|
||||
aux::type_wrapper<void_>
|
||||
BOOST_MPL_AUX_OVERLOAD_ITEM_BY_ORDER( m_mask<Key,Base> const&, typename m_mask<Key,Base>::key_order_* );
|
||||
|
||||
template< typename Key, typename T, typename Base >
|
||||
typename m_item<Key,T,Base>::order_tag_
|
||||
BOOST_MPL_AUX_OVERLOAD_ORDER_BY_KEY( m_item<Key,T,Base> const&, aux::type_wrapper<Key>* );
|
||||
|
||||
# define AUX778076_MAP_OVERLOAD(f) BOOST_PP_CAT(BOOST_MPL_AUX_OVERLOAD_,f)<>
|
||||
|
||||
# else
|
||||
# define AUX778076_MAP_OVERLOAD(f) BOOST_PP_CAT(BOOST_MPL_AUX_OVERLOAD_,f)
|
||||
# endif
|
||||
|
||||
|
||||
template< typename Key, typename T, typename Base >
|
||||
struct m_item
|
||||
: Base
|
||||
@@ -89,9 +49,9 @@ struct m_item
|
||||
typedef char (&order_tag_)[BOOST_MPL_AUX_MSVC_VALUE_WKND(order)::value];
|
||||
#endif
|
||||
|
||||
friend aux::type_wrapper<T> AUX778076_MAP_OVERLOAD(VALUE_BY_KEY)( m_item const&, aux::type_wrapper<Key>* );
|
||||
friend aux::type_wrapper<item> AUX778076_MAP_OVERLOAD(ITEM_BY_ORDER)( m_item const&, order* );
|
||||
friend order_tag_ AUX778076_MAP_OVERLOAD(ORDER_BY_KEY)( m_item const&, aux::type_wrapper<Key>* );
|
||||
BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper<T>, VALUE_BY_KEY, m_item, aux::type_wrapper<Key>* );
|
||||
BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper<item>, ITEM_BY_ORDER, m_item, order* );
|
||||
BOOST_MPL_AUX_MAP_OVERLOAD( order_tag_, ORDER_BY_KEY, m_item, aux::type_wrapper<Key>* );
|
||||
};
|
||||
|
||||
|
||||
@@ -105,16 +65,12 @@ struct m_mask
|
||||
typedef typename prior< typename Base::size >::type size;
|
||||
typedef typename x_order_impl<Base,Key>::type key_order_;
|
||||
|
||||
friend aux::type_wrapper<void_> AUX778076_MAP_OVERLOAD(VALUE_BY_KEY)( m_mask const&, aux::type_wrapper<Key>* );
|
||||
friend aux::type_wrapper<void_> AUX778076_MAP_OVERLOAD(ITEM_BY_ORDER)( m_mask const&, key_order_* );
|
||||
BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper<void_>, VALUE_BY_KEY, m_mask, aux::type_wrapper<Key>* );
|
||||
BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper<void_>, ITEM_BY_ORDER, m_mask, key_order_* );
|
||||
};
|
||||
|
||||
# undef AUX778076_MAP_OVERLOAD
|
||||
|
||||
#else // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
|
||||
|
||||
aux::no_tag BOOST_MPL_AUX_OVERLOAD_ORDER_BY_KEY( map0<> const&, void const volatile* );
|
||||
aux::no_tag BOOST_MPL_AUX_OVERLOAD_IS_MASKED( map0<> const&, void const volatile* );
|
||||
|
||||
template< long n, typename Key, typename T, typename Base >
|
||||
struct m_item;
|
||||
@@ -136,7 +92,7 @@ struct m_item_
|
||||
typedef char (&order_tag_)[BOOST_MPL_AUX_MSVC_VALUE_WKND(order)::value];
|
||||
#endif
|
||||
|
||||
friend order_tag_ BOOST_MPL_AUX_OVERLOAD_ORDER_BY_KEY( m_item_ const&, aux::type_wrapper<Key>* );
|
||||
BOOST_MPL_AUX_MAP_OVERLOAD( order_tag_, ORDER_BY_KEY, m_item_, aux::type_wrapper<Key>* );
|
||||
};
|
||||
|
||||
template< typename Key, typename Base >
|
||||
@@ -149,8 +105,8 @@ struct m_mask
|
||||
typedef typename prior< typename Base::size >::type size;
|
||||
typedef typename x_order_impl<Base,Key>::type key_order_;
|
||||
|
||||
friend aux::no_tag BOOST_MPL_AUX_OVERLOAD_ORDER_BY_KEY( m_mask const&, aux::type_wrapper<Key>* );
|
||||
friend aux::yes_tag BOOST_MPL_AUX_OVERLOAD_IS_MASKED( m_mask const&, key_order_* );
|
||||
BOOST_MPL_AUX_MAP_OVERLOAD( aux::no_tag, ORDER_BY_KEY, m_mask, aux::type_wrapper<Key>* );
|
||||
BOOST_MPL_AUX_MAP_OVERLOAD( aux::yes_tag, IS_MASKED, m_mask, key_order_* );
|
||||
};
|
||||
|
||||
#endif // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
|
||||
|
@@ -19,9 +19,38 @@
|
||||
#include <boost/mpl/void.hpp>
|
||||
#include <boost/mpl/map/aux_/tag.hpp>
|
||||
#include <boost/mpl/aux_/na.hpp>
|
||||
#include <boost/mpl/aux_/yes_no.hpp>
|
||||
#include <boost/mpl/aux_/overload_names.hpp>
|
||||
#include <boost/mpl/aux_/config/operators.hpp>
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
#if defined(BOOST_MPL_CFG_USE_OPERATORS_OVERLOADING)
|
||||
|
||||
# define BOOST_MPL_AUX_MAP0_OVERLOAD(R, f, X, T) \
|
||||
friend R BOOST_PP_CAT(BOOST_MPL_AUX_OVERLOAD_,f)(X const&, T) \
|
||||
/**/
|
||||
|
||||
# define BOOST_MPL_AUX_MAP_OVERLOAD(R, f, X, T) \
|
||||
BOOST_MPL_AUX_MAP0_OVERLOAD(R, f, X, T) \
|
||||
/**/
|
||||
|
||||
#else
|
||||
|
||||
# define BOOST_MPL_AUX_MAP0_OVERLOAD(R, f, X, T) \
|
||||
static R BOOST_PP_CAT(BOOST_MPL_AUX_OVERLOAD_,f)(X const&, T) \
|
||||
/**/
|
||||
|
||||
# define BOOST_MPL_AUX_MAP_OVERLOAD(R, f, X, T) \
|
||||
BOOST_MPL_AUX_MAP0_OVERLOAD(R, f, X, T); \
|
||||
using Base::BOOST_PP_CAT(BOOST_MPL_AUX_OVERLOAD_,f) \
|
||||
/**/
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
template< typename Dummy = na > struct map0
|
||||
{
|
||||
typedef map0 type;
|
||||
@@ -29,6 +58,15 @@ template< typename Dummy = na > struct map0
|
||||
typedef void_ key_;
|
||||
typedef long_<1> order;
|
||||
typedef long_<0> size;
|
||||
|
||||
#if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
|
||||
BOOST_MPL_AUX_MAP0_OVERLOAD( aux::type_wrapper<void_>, VALUE_BY_KEY, map0<>, void const volatile* );
|
||||
BOOST_MPL_AUX_MAP0_OVERLOAD( aux::type_wrapper<void_>, ITEM_BY_ORDER, map0<>, long_<1>* );
|
||||
BOOST_MPL_AUX_MAP0_OVERLOAD( aux::no_tag, ORDER_BY_KEY, map0<>, void const volatile* );
|
||||
#else
|
||||
BOOST_MPL_AUX_MAP0_OVERLOAD( aux::no_tag, ORDER_BY_KEY, map0<>, void const volatile* );
|
||||
BOOST_MPL_AUX_MAP0_OVERLOAD( aux::no_tag, IS_MASKED, map0<>, void const volatile* );
|
||||
#endif
|
||||
};
|
||||
|
||||
}}
|
||||
|
@@ -22,7 +22,6 @@
|
||||
#include <boost/mpl/aux_/static_cast.hpp>
|
||||
#include <boost/mpl/aux_/yes_no.hpp>
|
||||
#include <boost/mpl/aux_/type_wrapper.hpp>
|
||||
#include <boost/mpl/aux_/ptr_to_ref.hpp>
|
||||
#include <boost/mpl/aux_/config/workaround.hpp>
|
||||
#include <boost/mpl/aux_/config/static_constant.hpp>
|
||||
|
||||
@@ -36,8 +35,8 @@ struct has_key_impl< aux::set_tag >
|
||||
|| BOOST_WORKAROUND(__EDG_VERSION__, <= 245)
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
( sizeof( BOOST_MPL_AUX_OVERLOAD_IS_MASKED(
|
||||
*BOOST_MPL_AUX_STATIC_CAST(Set*, 0)
|
||||
( sizeof( BOOST_MPL_AUX_OVERLOAD_CALL_IS_MASKED(
|
||||
Set
|
||||
, BOOST_MPL_AUX_STATIC_CAST(aux::type_wrapper<T>*, 0)
|
||||
) ) == sizeof(aux::no_tag) )
|
||||
);
|
||||
@@ -46,8 +45,8 @@ struct has_key_impl< aux::set_tag >
|
||||
|
||||
#else // ISO98 C++
|
||||
: bool_<
|
||||
( sizeof( BOOST_MPL_AUX_OVERLOAD_IS_MASKED(
|
||||
aux::ptr_to_ref(BOOST_MPL_AUX_STATIC_CAST(Set*, 0))
|
||||
( sizeof( BOOST_MPL_AUX_OVERLOAD_CALL_IS_MASKED(
|
||||
Set
|
||||
, BOOST_MPL_AUX_STATIC_CAST(aux::type_wrapper<T>*, 0)
|
||||
) ) == sizeof(aux::no_tag) )
|
||||
>
|
||||
|
@@ -20,50 +20,11 @@
|
||||
#include <boost/mpl/next.hpp>
|
||||
#include <boost/mpl/prior.hpp>
|
||||
#include <boost/mpl/set/aux_/set0.hpp>
|
||||
#include <boost/mpl/aux_/overload_names.hpp>
|
||||
#include <boost/mpl/aux_/yes_no.hpp>
|
||||
#include <boost/mpl/aux_/type_wrapper.hpp>
|
||||
#include <boost/mpl/aux_/config/arrays.hpp>
|
||||
#include <boost/mpl/aux_/config/operators.hpp>
|
||||
#include <boost/mpl/aux_/config/static_constant.hpp>
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
aux::no_tag BOOST_MPL_AUX_OVERLOAD_ORDER_BY_KEY( set0<> const&, void const volatile* );
|
||||
aux::yes_tag BOOST_MPL_AUX_OVERLOAD_IS_MASKED( set0<> const&, void const volatile* );
|
||||
|
||||
#if defined(BOOST_MPL_CFG_USE_OPERATORS_SPECIALIZATION)
|
||||
|
||||
template< typename T, typename Base > struct s_item;
|
||||
template< typename T, typename Base > struct s_mask;
|
||||
template< typename T, typename Base > struct s_unmask;
|
||||
|
||||
template< typename T, typename Base >
|
||||
typename s_item<T,Base>::order_tag_
|
||||
BOOST_MPL_AUX_OVERLOAD_ORDER_BY_KEY( s_item<T,Base> const&, aux::type_wrapper<T>* );
|
||||
|
||||
template< typename T, typename Base >
|
||||
aux::no_tag
|
||||
BOOST_MPL_AUX_OVERLOAD_IS_MASKED( s_item<T,Base> const&, aux::type_wrapper<T>* );
|
||||
|
||||
template< typename T, typename Base >
|
||||
aux::no_tag
|
||||
BOOST_MPL_AUX_OVERLOAD_IS_MASKED( s_unmask<T,Base> const&, aux::type_wrapper<T>* );
|
||||
|
||||
template< typename T, typename Base >
|
||||
aux::yes_tag
|
||||
BOOST_MPL_AUX_OVERLOAD_IS_MASKED( s_mask<T,Base> const&, aux::type_wrapper<T>* );
|
||||
|
||||
# define AUX778076_SET_OVERLOAD(f) BOOST_PP_CAT(BOOST_MPL_AUX_OVERLOAD_,f)<>
|
||||
|
||||
# else
|
||||
# define AUX778076_SET_OVERLOAD(f) BOOST_PP_CAT(BOOST_MPL_AUX_OVERLOAD_,f)
|
||||
# endif
|
||||
|
||||
|
||||
template< typename T, typename Base >
|
||||
struct s_item
|
||||
: Base
|
||||
@@ -83,8 +44,8 @@ struct s_item
|
||||
typedef char (&order_tag_)[BOOST_MPL_AUX_MSVC_VALUE_WKND(order)::value];
|
||||
#endif
|
||||
|
||||
friend order_tag_ AUX778076_SET_OVERLOAD(ORDER_BY_KEY)( s_item const&, aux::type_wrapper<T>* );
|
||||
friend aux::no_tag AUX778076_SET_OVERLOAD(IS_MASKED)( s_item const&, aux::type_wrapper<T>* );
|
||||
BOOST_MPL_AUX_SET_OVERLOAD( order_tag_, ORDER_BY_KEY, s_item, aux::type_wrapper<T>* );
|
||||
BOOST_MPL_AUX_SET_OVERLOAD( aux::no_tag, IS_MASKED, s_item, aux::type_wrapper<T>* );
|
||||
};
|
||||
|
||||
|
||||
@@ -97,7 +58,7 @@ struct s_mask
|
||||
typedef Base base;
|
||||
typedef typename prior< typename Base::size >::type size;
|
||||
|
||||
friend aux::yes_tag AUX778076_SET_OVERLOAD(IS_MASKED)( s_mask const&, aux::type_wrapper<T>* );
|
||||
BOOST_MPL_AUX_SET_OVERLOAD( aux::yes_tag, IS_MASKED, s_mask, aux::type_wrapper<T>* );
|
||||
};
|
||||
|
||||
|
||||
@@ -110,11 +71,9 @@ struct s_unmask
|
||||
typedef Base base;
|
||||
typedef typename next< typename Base::size >::type size;
|
||||
|
||||
friend aux::no_tag AUX778076_SET_OVERLOAD(IS_MASKED)( s_unmask const&, aux::type_wrapper<T>* );
|
||||
BOOST_MPL_AUX_SET_OVERLOAD( aux::no_tag, IS_MASKED, s_unmask, aux::type_wrapper<T>* );
|
||||
};
|
||||
|
||||
#undef AUX778076_SET_OVERLOAD
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_SET_AUX_ITEM_HPP_INCLUDED
|
||||
|
@@ -19,9 +19,38 @@
|
||||
#include <boost/mpl/void.hpp>
|
||||
#include <boost/mpl/aux_/na.hpp>
|
||||
#include <boost/mpl/set/aux_/tag.hpp>
|
||||
#include <boost/mpl/aux_/yes_no.hpp>
|
||||
#include <boost/mpl/aux_/overload_names.hpp>
|
||||
#include <boost/mpl/aux_/config/operators.hpp>
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
#if defined(BOOST_MPL_CFG_USE_OPERATORS_OVERLOADING)
|
||||
|
||||
# define BOOST_MPL_AUX_SET0_OVERLOAD(R, f, X, T) \
|
||||
friend R BOOST_PP_CAT(BOOST_MPL_AUX_OVERLOAD_,f)(X const&, T) \
|
||||
/**/
|
||||
|
||||
# define BOOST_MPL_AUX_SET_OVERLOAD(R, f, X, T) \
|
||||
BOOST_MPL_AUX_SET0_OVERLOAD(R, f, X, T) \
|
||||
/**/
|
||||
|
||||
#else
|
||||
|
||||
# define BOOST_MPL_AUX_SET0_OVERLOAD(R, f, X, T) \
|
||||
static R BOOST_PP_CAT(BOOST_MPL_AUX_OVERLOAD_,f)(X const&, T) \
|
||||
/**/
|
||||
|
||||
# define BOOST_MPL_AUX_SET_OVERLOAD(R, f, X, T) \
|
||||
BOOST_MPL_AUX_SET0_OVERLOAD(R, f, X, T); \
|
||||
using Base::BOOST_PP_CAT(BOOST_MPL_AUX_OVERLOAD_,f) \
|
||||
/**/
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
template< typename Dummy = na > struct set0
|
||||
{
|
||||
typedef aux::set_tag tag;
|
||||
@@ -30,6 +59,9 @@ template< typename Dummy = na > struct set0
|
||||
typedef item_type_ type;
|
||||
typedef long_<0> size;
|
||||
typedef long_<1> order;
|
||||
|
||||
BOOST_MPL_AUX_SET0_OVERLOAD( aux::no_tag, ORDER_BY_KEY, set0<>, void const volatile* );
|
||||
BOOST_MPL_AUX_SET0_OVERLOAD( aux::yes_tag, IS_MASKED, set0<>, void const volatile* );
|
||||
};
|
||||
|
||||
}}
|
||||
|
@@ -93,6 +93,7 @@ MPL_TEST_CASE()
|
||||
|
||||
}
|
||||
|
||||
|
||||
MPL_TEST_CASE()
|
||||
{
|
||||
typedef set0<> s;
|
||||
|
Reference in New Issue
Block a user