mirror of
https://github.com/boostorg/detail.git
synced 2025-07-31 04:47:15 +02:00
first try at fixing is_incrementable for gcc 4.0.2
[SVN r31240]
This commit is contained in:
@ -9,10 +9,9 @@
|
|||||||
# include <boost/type_traits/remove_cv.hpp>
|
# include <boost/type_traits/remove_cv.hpp>
|
||||||
# include <boost/mpl/aux_/lambda_support.hpp>
|
# include <boost/mpl/aux_/lambda_support.hpp>
|
||||||
# include <boost/mpl/bool.hpp>
|
# include <boost/mpl/bool.hpp>
|
||||||
|
# include <boost/config.hpp> // BOOST_INTEL
|
||||||
# include <boost/detail/workaround.hpp>
|
# include <boost/detail/workaround.hpp>
|
||||||
|
|
||||||
namespace boost { namespace detail {
|
|
||||||
|
|
||||||
// is_incrementable<T> metafunction
|
// is_incrementable<T> metafunction
|
||||||
//
|
//
|
||||||
// Requires: Given x of type T&, if the expression ++x is well-formed
|
// Requires: Given x of type T&, if the expression ++x is well-formed
|
||||||
@ -20,7 +19,7 @@ namespace boost { namespace detail {
|
|||||||
// nor violate access.
|
// nor violate access.
|
||||||
|
|
||||||
// This namespace ensures that ADL doesn't mess things up.
|
// This namespace ensures that ADL doesn't mess things up.
|
||||||
namespace is_incrementable_
|
namespace boost_is_incrementable_
|
||||||
{
|
{
|
||||||
// a type returned from operator++ when no increment is found in the
|
// a type returned from operator++ when no increment is found in the
|
||||||
// type's own namespace
|
// type's own namespace
|
||||||
@ -31,10 +30,32 @@ namespace is_incrementable_
|
|||||||
// might be found via ADL.
|
// might be found via ADL.
|
||||||
struct any { template <class T> any(T const&); };
|
struct any { template <class T> any(T const&); };
|
||||||
|
|
||||||
|
# if defined(__GNUC_PATCHLEVEL__) && !defined(BOOST_INTEL)
|
||||||
|
# define BOOST_IS_INCREMENTABLE_GCC \
|
||||||
|
((__GNUC__ * 100UL + __GNUC_MINOR__) * 100UL + __GNUC_PATCHLEVEL__) \
|
||||||
|
/**/
|
||||||
|
# else
|
||||||
|
# define BOOST_IS_INCREMENTABLE_GCC 0
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if BOOST_WORKAROUND(BOOST_IS_INCREMENTABLE_GCC, >= 40002)
|
||||||
|
|
||||||
|
} // namespace boost_is_incrementable_
|
||||||
|
|
||||||
|
// This is a last-resort operator++ for when none other is found
|
||||||
|
boost_is_incrementable_::tag operator++(boost_is_incrementable_::any const&);
|
||||||
|
boost_is_incrementable_::tag operator++(boost_is_incrementable_::any const&,int);
|
||||||
|
|
||||||
|
namespace boost_is_incrementable_ {
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
// This is a last-resort operator++ for when none other is found
|
// This is a last-resort operator++ for when none other is found
|
||||||
tag operator++(any const&);
|
tag operator++(any const&);
|
||||||
tag operator++(any const&,int);
|
tag operator++(any const&,int);
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) \
|
# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) \
|
||||||
|| BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
|| BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||||
# define BOOST_comma(a,b) (a)
|
# define BOOST_comma(a,b) (a)
|
||||||
@ -58,7 +79,7 @@ namespace is_incrementable_
|
|||||||
|
|
||||||
BOOST_STATIC_CONSTANT(
|
BOOST_STATIC_CONSTANT(
|
||||||
bool
|
bool
|
||||||
, value = sizeof(is_incrementable_::check(BOOST_comma(++x,0))) == 1
|
, value = sizeof(boost_is_incrementable_::check(BOOST_comma(++x,0))) == 1
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -69,26 +90,28 @@ namespace is_incrementable_
|
|||||||
|
|
||||||
BOOST_STATIC_CONSTANT(
|
BOOST_STATIC_CONSTANT(
|
||||||
bool
|
bool
|
||||||
, value = sizeof(is_incrementable_::check(BOOST_comma(x++,0))) == 1
|
, value = sizeof(boost_is_incrementable_::check(BOOST_comma(x++,0))) == 1
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
}
|
} // namespace boost_is_incrementable_
|
||||||
|
|
||||||
|
namespace boost { namespace detail {
|
||||||
|
|
||||||
# undef BOOST_comma
|
# undef BOOST_comma
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct is_incrementable
|
struct is_incrementable
|
||||||
BOOST_TT_AUX_BOOL_C_BASE(::boost::detail::is_incrementable_::impl<T>::value)
|
BOOST_TT_AUX_BOOL_C_BASE(::boost_is_incrementable_::impl<T>::value)
|
||||||
{
|
{
|
||||||
BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::boost::detail::is_incrementable_::impl<T>::value)
|
BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::boost_is_incrementable_::impl<T>::value)
|
||||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_incrementable,(T))
|
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_incrementable,(T))
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct is_postfix_incrementable
|
struct is_postfix_incrementable
|
||||||
BOOST_TT_AUX_BOOL_C_BASE(::boost::detail::is_incrementable_::impl<T>::value)
|
BOOST_TT_AUX_BOOL_C_BASE(::boost_is_incrementable_::impl<T>::value)
|
||||||
{
|
{
|
||||||
BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::boost::detail::is_incrementable_::postfix_impl<T>::value)
|
BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::boost_is_incrementable_::postfix_impl<T>::value)
|
||||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_postfix_incrementable,(T))
|
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_postfix_incrementable,(T))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user