From 46579f35a4c74a36608d2ffd03651be0b03f04d1 Mon Sep 17 00:00:00 2001 From: Aleksey Gurtovoy Date: Wed, 13 Oct 2004 18:25:11 +0000 Subject: [PATCH] rework set/map to workaround GCC 3.4 problems [SVN r25712] --- include/boost/mpl/aux_/config/operators.hpp | 15 +++--- include/boost/mpl/aux_/order_impl.hpp | 7 ++- include/boost/mpl/aux_/overload_names.hpp | 25 ++++----- include/boost/mpl/aux_/ptr_to_ref.hpp | 21 ++++++++ include/boost/mpl/map/aux_/at_impl.hpp | 6 +-- include/boost/mpl/map/aux_/item.hpp | 60 +++------------------ include/boost/mpl/map/aux_/map0.hpp | 38 +++++++++++++ include/boost/mpl/set/aux_/has_key_impl.hpp | 9 ++-- include/boost/mpl/set/aux_/item.hpp | 49 ++--------------- include/boost/mpl/set/aux_/set0.hpp | 32 +++++++++++ test/set.cpp | 1 + 11 files changed, 135 insertions(+), 128 deletions(-) diff --git a/include/boost/mpl/aux_/config/operators.hpp b/include/boost/mpl/aux_/config/operators.hpp index 99e9a84..2ac3ab8 100644 --- a/include/boost/mpl/aux_/config/operators.hpp +++ b/include/boost/mpl/aux_/config/operators.hpp @@ -15,16 +15,17 @@ // $Revision$ #include +#include #include -// 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 diff --git a/include/boost/mpl/aux_/order_impl.hpp b/include/boost/mpl/aux_/order_impl.hpp index ba89135..e4e1e8d 100644 --- a/include/boost/mpl/aux_/order_impl.hpp +++ b/include/boost/mpl/aux_/order_impl.hpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -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*, 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*, 0) ) ) > diff --git a/include/boost/mpl/aux_/overload_names.hpp b/include/boost/mpl/aux_/overload_names.hpp index 87a8a56..4eb1569 100644 --- a/include/boost/mpl/aux_/overload_names.hpp +++ b/include/boost/mpl/aux_/overload_names.hpp @@ -14,21 +14,22 @@ // $Date$ // $Revision$ -#include -#include +#include +#include -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \ - || BOOST_WORKAROUND(__EDG_VERSION__, <= 245) +#if defined(BOOST_MPL_CFG_USE_OPERATORS_OVERLOADING) + +# include # 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 diff --git a/include/boost/mpl/aux_/ptr_to_ref.hpp b/include/boost/mpl/aux_/ptr_to_ref.hpp index 4c7e1e8..07eaed0 100644 --- a/include/boost/mpl/aux_/ptr_to_ref.hpp +++ b/include/boost/mpl/aux_/ptr_to_ref.hpp @@ -14,6 +14,27 @@ // $Date$ // $Revision$ +#include +#include +#include + + +#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*); diff --git a/include/boost/mpl/map/aux_/at_impl.hpp b/include/boost/mpl/map/aux_/at_impl.hpp index 12ec42f..7d1ee95 100644 --- a/include/boost/mpl/map/aux_/at_impl.hpp +++ b/include/boost/mpl/map/aux_/at_impl.hpp @@ -41,7 +41,7 @@ struct m_at { typedef aux::type_wrapper 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_*, 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_*, 0) ) ) == sizeof(aux::yes_tag) ); diff --git a/include/boost/mpl/map/aux_/item.hpp b/include/boost/mpl/map/aux_/item.hpp index e9237c9..55a8634 100644 --- a/include/boost/mpl/map/aux_/item.hpp +++ b/include/boost/mpl/map/aux_/item.hpp @@ -22,56 +22,16 @@ #include #include #include -#include #include #include #include -#include #include -#include - namespace boost { namespace mpl { #if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES) -aux::type_wrapper BOOST_MPL_AUX_OVERLOAD_VALUE_BY_KEY( map0<> const&, void const volatile* ); -aux::type_wrapper 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 -BOOST_MPL_AUX_OVERLOAD_VALUE_BY_KEY( m_item const&, aux::type_wrapper* ); - -template< typename Key, typename T, typename Base > -aux::type_wrapper< typename m_item::item > -BOOST_MPL_AUX_OVERLOAD_ITEM_BY_ORDER( m_item const&, typename m_item::order* ); - -template< typename Key, typename Base > -aux::type_wrapper -BOOST_MPL_AUX_OVERLOAD_VALUE_BY_KEY( m_mask const&, aux::type_wrapper* ); - -template< typename Key, typename Base > -aux::type_wrapper -BOOST_MPL_AUX_OVERLOAD_ITEM_BY_ORDER( m_mask const&, typename m_mask::key_order_* ); - -template< typename Key, typename T, typename Base > -typename m_item::order_tag_ -BOOST_MPL_AUX_OVERLOAD_ORDER_BY_KEY( m_item const&, aux::type_wrapper* ); - -# 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 AUX778076_MAP_OVERLOAD(VALUE_BY_KEY)( m_item const&, aux::type_wrapper* ); - friend aux::type_wrapper 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* ); + BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper, VALUE_BY_KEY, m_item, aux::type_wrapper* ); + BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper, ITEM_BY_ORDER, m_item, order* ); + BOOST_MPL_AUX_MAP_OVERLOAD( order_tag_, ORDER_BY_KEY, m_item, aux::type_wrapper* ); }; @@ -105,16 +65,12 @@ struct m_mask typedef typename prior< typename Base::size >::type size; typedef typename x_order_impl::type key_order_; - friend aux::type_wrapper AUX778076_MAP_OVERLOAD(VALUE_BY_KEY)( m_mask const&, aux::type_wrapper* ); - friend aux::type_wrapper AUX778076_MAP_OVERLOAD(ITEM_BY_ORDER)( m_mask const&, key_order_* ); + BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper, VALUE_BY_KEY, m_mask, aux::type_wrapper* ); + BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper, 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* ); + BOOST_MPL_AUX_MAP_OVERLOAD( order_tag_, ORDER_BY_KEY, m_item_, aux::type_wrapper* ); }; 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::type key_order_; - friend aux::no_tag BOOST_MPL_AUX_OVERLOAD_ORDER_BY_KEY( m_mask const&, aux::type_wrapper* ); - 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* ); + BOOST_MPL_AUX_MAP_OVERLOAD( aux::yes_tag, IS_MASKED, m_mask, key_order_* ); }; #endif // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES diff --git a/include/boost/mpl/map/aux_/map0.hpp b/include/boost/mpl/map/aux_/map0.hpp index e9a60b8..a218e8f 100644 --- a/include/boost/mpl/map/aux_/map0.hpp +++ b/include/boost/mpl/map/aux_/map0.hpp @@ -19,9 +19,38 @@ #include #include #include +#include +#include +#include + +#include 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, VALUE_BY_KEY, map0<>, void const volatile* ); + BOOST_MPL_AUX_MAP0_OVERLOAD( aux::type_wrapper, 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 }; }} diff --git a/include/boost/mpl/set/aux_/has_key_impl.hpp b/include/boost/mpl/set/aux_/has_key_impl.hpp index 5b15b06..05d25a3 100644 --- a/include/boost/mpl/set/aux_/has_key_impl.hpp +++ b/include/boost/mpl/set/aux_/has_key_impl.hpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -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*, 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*, 0) ) ) == sizeof(aux::no_tag) ) > diff --git a/include/boost/mpl/set/aux_/item.hpp b/include/boost/mpl/set/aux_/item.hpp index 66e68e1..2c2e527 100644 --- a/include/boost/mpl/set/aux_/item.hpp +++ b/include/boost/mpl/set/aux_/item.hpp @@ -20,50 +20,11 @@ #include #include #include -#include -#include #include #include -#include -#include - -#include - 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::order_tag_ -BOOST_MPL_AUX_OVERLOAD_ORDER_BY_KEY( s_item const&, aux::type_wrapper* ); - -template< typename T, typename Base > -aux::no_tag -BOOST_MPL_AUX_OVERLOAD_IS_MASKED( s_item const&, aux::type_wrapper* ); - -template< typename T, typename Base > -aux::no_tag -BOOST_MPL_AUX_OVERLOAD_IS_MASKED( s_unmask const&, aux::type_wrapper* ); - -template< typename T, typename Base > -aux::yes_tag -BOOST_MPL_AUX_OVERLOAD_IS_MASKED( s_mask const&, aux::type_wrapper* ); - -# 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* ); - friend aux::no_tag AUX778076_SET_OVERLOAD(IS_MASKED)( s_item const&, aux::type_wrapper* ); + BOOST_MPL_AUX_SET_OVERLOAD( order_tag_, ORDER_BY_KEY, s_item, aux::type_wrapper* ); + BOOST_MPL_AUX_SET_OVERLOAD( aux::no_tag, IS_MASKED, s_item, aux::type_wrapper* ); }; @@ -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* ); + BOOST_MPL_AUX_SET_OVERLOAD( aux::yes_tag, IS_MASKED, s_mask, aux::type_wrapper* ); }; @@ -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* ); + BOOST_MPL_AUX_SET_OVERLOAD( aux::no_tag, IS_MASKED, s_unmask, aux::type_wrapper* ); }; -#undef AUX778076_SET_OVERLOAD - }} #endif // BOOST_MPL_SET_AUX_ITEM_HPP_INCLUDED diff --git a/include/boost/mpl/set/aux_/set0.hpp b/include/boost/mpl/set/aux_/set0.hpp index 35b2726..7c3c312 100644 --- a/include/boost/mpl/set/aux_/set0.hpp +++ b/include/boost/mpl/set/aux_/set0.hpp @@ -19,9 +19,38 @@ #include #include #include +#include +#include +#include + +#include 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* ); }; }} diff --git a/test/set.cpp b/test/set.cpp index 4d9df27..35f980b 100644 --- a/test/set.cpp +++ b/test/set.cpp @@ -93,6 +93,7 @@ MPL_TEST_CASE() } + MPL_TEST_CASE() { typedef set0<> s;