mirror of
https://github.com/boostorg/mpl.git
synced 2025-08-05 15:54:39 +02:00
Fix for lambda expressions with bound reference types
[SVN r16285]
This commit is contained in:
@@ -23,6 +23,10 @@
|
|||||||
#include "boost/mpl/aux_/config/overload_resolution.hpp"
|
#include "boost/mpl/aux_/config/overload_resolution.hpp"
|
||||||
#include "boost/config.hpp"
|
#include "boost/config.hpp"
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
|
||||||
|
# include "boost/type_traits/is_reference.hpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace mpl {
|
namespace mpl {
|
||||||
namespace aux {
|
namespace aux {
|
||||||
@@ -57,21 +61,40 @@ struct has_rebind
|
|||||||
// note that the code is _not_ standard-conforming, but it works,
|
// note that the code is _not_ standard-conforming, but it works,
|
||||||
// and it resolves some nasty ICE cases with the above implementation
|
// and it resolves some nasty ICE cases with the above implementation
|
||||||
|
|
||||||
template< typename T, typename rebind = int >
|
template < bool ref = true >
|
||||||
struct has_rebind : T
|
struct has_rebind_impl
|
||||||
{
|
{
|
||||||
private:
|
template < typename T > struct apply
|
||||||
static no_tag test(int*);
|
{
|
||||||
static yes_tag test(...);
|
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
template <>
|
||||||
BOOST_STATIC_CONSTANT(bool, value =
|
struct has_rebind_impl< false >
|
||||||
sizeof(test(static_cast<rebind*>(0))) != sizeof(no_tag)
|
{
|
||||||
);
|
template < typename T, typename rebind = int >
|
||||||
|
struct apply : T
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
static no_tag test(int*);
|
||||||
|
static yes_tag test(...);
|
||||||
|
|
||||||
|
public:
|
||||||
|
BOOST_STATIC_CONSTANT(
|
||||||
|
bool, value = sizeof(test(static_cast<rebind*>(0))) != sizeof(no_tag)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template < typename T >
|
||||||
|
struct has_rebind
|
||||||
|
: has_rebind_impl<boost::detail::is_reference_impl<T>::value>::template apply<T>
|
||||||
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
# define AUX_HAS_REBIND_SPEC(T) \
|
# define AUX_HAS_REBIND_SPEC(T) \
|
||||||
template<> struct has_rebind<T,int> \
|
template<> struct has_rebind<T> \
|
||||||
{ \
|
{ \
|
||||||
enum { value = false }; \
|
enum { value = false }; \
|
||||||
}; \
|
}; \
|
||||||
|
@@ -88,11 +88,32 @@ aux::yes_tag is_bind_helper(arg<N>*);
|
|||||||
template< typename F, typename T > aux::yes_tag is_bind_helper(bind1st< F,T >*);
|
template< typename F, typename T > aux::yes_tag is_bind_helper(bind1st< F,T >*);
|
||||||
template< typename F, typename T > aux::yes_tag is_bind_helper(bind2nd< F,T >*);
|
template< typename F, typename T > aux::yes_tag is_bind_helper(bind2nd< F,T >*);
|
||||||
|
|
||||||
template< typename T > struct is_bind_template
|
template < bool ref = true >
|
||||||
|
struct is_bind_template_impl
|
||||||
|
{
|
||||||
|
template < typename T >
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct is_bind_template_impl<false>
|
||||||
|
{
|
||||||
|
template< typename T >
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value = sizeof(aux::is_bind_helper(static_cast<T*>(0)))
|
||||||
|
== sizeof(aux::yes_tag)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template< typename T > struct is_bind_template
|
||||||
|
: is_bind_template_impl<boost::detail::is_reference_impl< T >::value>
|
||||||
|
::template apply< T >
|
||||||
{
|
{
|
||||||
BOOST_STATIC_CONSTANT(bool, value = sizeof(aux::is_bind_helper(static_cast<T*>(0)))
|
|
||||||
== sizeof(aux::yes_tag)
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace aux
|
} // namespace aux
|
||||||
|
@@ -88,11 +88,32 @@ aux::yes_tag is_bind_helper(arg<N>*);
|
|||||||
template< typename F, typename T > aux::yes_tag is_bind_helper(bind1st< F,T >*);
|
template< typename F, typename T > aux::yes_tag is_bind_helper(bind1st< F,T >*);
|
||||||
template< typename F, typename T > aux::yes_tag is_bind_helper(bind2nd< F,T >*);
|
template< typename F, typename T > aux::yes_tag is_bind_helper(bind2nd< F,T >*);
|
||||||
|
|
||||||
template< typename T > struct is_bind_template
|
template < bool ref = true >
|
||||||
|
struct is_bind_template_impl
|
||||||
|
{
|
||||||
|
template < typename T >
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct is_bind_template_impl<false>
|
||||||
|
{
|
||||||
|
template< typename T >
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value = sizeof(aux::is_bind_helper(static_cast<T*>(0)))
|
||||||
|
== sizeof(aux::yes_tag)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template< typename T > struct is_bind_template
|
||||||
|
: is_bind_template_impl<boost::detail::is_reference_impl< T >::value>
|
||||||
|
::template apply< T >
|
||||||
{
|
{
|
||||||
BOOST_STATIC_CONSTANT(bool, value = sizeof(aux::is_bind_helper(static_cast<T*>(0)))
|
|
||||||
== sizeof(aux::yes_tag)
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace aux
|
} // namespace aux
|
||||||
|
@@ -25,6 +25,11 @@
|
|||||||
#include "boost/mpl/aux_/config/bind.hpp"
|
#include "boost/mpl/aux_/config/bind.hpp"
|
||||||
#include "boost/mpl/aux_/config/lambda.hpp"
|
#include "boost/mpl/aux_/config/lambda.hpp"
|
||||||
|
|
||||||
|
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
# include "boost/type_traits/is_reference.hpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if !defined(BOOST_MPL_PREPROCESSING_MODE)
|
#if !defined(BOOST_MPL_PREPROCESSING_MODE)
|
||||||
# include "boost/mpl/placeholder.hpp"
|
# include "boost/mpl/placeholder.hpp"
|
||||||
# include "boost/mpl/void.hpp"
|
# include "boost/mpl/void.hpp"
|
||||||
@@ -295,12 +300,32 @@ aux::yes_tag is_bind_helper(arg<N>*);
|
|||||||
template< typename F, typename T > aux::yes_tag is_bind_helper(bind1st<F,T>*);
|
template< typename F, typename T > aux::yes_tag is_bind_helper(bind1st<F,T>*);
|
||||||
template< typename F, typename T > aux::yes_tag is_bind_helper(bind2nd<F,T>*);
|
template< typename F, typename T > aux::yes_tag is_bind_helper(bind2nd<F,T>*);
|
||||||
|
|
||||||
template< typename T > struct is_bind_template
|
template < bool ref = true >
|
||||||
|
struct is_bind_template_impl
|
||||||
|
{
|
||||||
|
template < typename T >
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct is_bind_template_impl<false>
|
||||||
|
{
|
||||||
|
template< typename T >
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value = sizeof(aux::is_bind_helper(static_cast<T*>(0)))
|
||||||
|
== sizeof(aux::yes_tag)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template< typename T > struct is_bind_template
|
||||||
|
: is_bind_template_impl<boost::detail::is_reference_impl< T >::value>
|
||||||
|
::template apply< T >
|
||||||
{
|
{
|
||||||
BOOST_STATIC_CONSTANT(bool, value =
|
|
||||||
sizeof(aux::is_bind_helper(static_cast<T*>(0)))
|
|
||||||
== sizeof(aux::yes_tag)
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
Reference in New Issue
Block a user