mirror of
https://github.com/boostorg/mpl.git
synced 2025-08-03 06:44:37 +02:00
merged from trunk
[SVN r21489]
This commit is contained in:
@@ -33,23 +33,25 @@
|
||||
|
||||
# define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, unused) \
|
||||
template< typename T > \
|
||||
boost::mpl::aux::yes_tag \
|
||||
trait##_helper( \
|
||||
boost::mpl::aux::type_wrapper<T> const volatile* \
|
||||
, boost::mpl::aux::type_wrapper<BOOST_MSVC_TYPENAME T::name>* = 0 \
|
||||
); \
|
||||
\
|
||||
boost::mpl::aux::no_tag \
|
||||
trait##_helper(...); \
|
||||
\
|
||||
template< typename T > \
|
||||
struct trait \
|
||||
{ \
|
||||
template< typename U > \
|
||||
static boost::mpl::aux::yes_tag \
|
||||
helper( \
|
||||
boost::mpl::aux::type_wrapper<U> const volatile* \
|
||||
, boost::mpl::aux::type_wrapper<BOOST_MSVC_TYPENAME U::name>* = 0 \
|
||||
); \
|
||||
\
|
||||
static boost::mpl::aux::no_tag \
|
||||
helper(...); \
|
||||
\
|
||||
typedef boost::mpl::aux::type_wrapper<T> t_; \
|
||||
BOOST_STATIC_CONSTANT(bool, value = \
|
||||
sizeof((trait##_helper)(static_cast<t_*>(0))) \
|
||||
== sizeof(boost::mpl::aux::yes_tag) \
|
||||
); \
|
||||
\
|
||||
BOOST_STATIC_CONSTANT( \
|
||||
bool, value = \
|
||||
sizeof(trait<T>::helper(static_cast<t_*>(0))) \
|
||||
== sizeof(boost::mpl::aux::yes_tag) \
|
||||
); \
|
||||
}; \
|
||||
/**/
|
||||
|
||||
|
@@ -35,6 +35,8 @@ struct b5 { typedef int xxx[10]; };
|
||||
struct b6 { typedef void (*xxx)(); };
|
||||
struct b7 { typedef void (xxx)(); };
|
||||
|
||||
template <class T> struct outer;
|
||||
template <class T> struct inner { typedef typename T::type type; };
|
||||
|
||||
int main()
|
||||
{
|
||||
@@ -59,5 +61,7 @@ int main()
|
||||
BOOST_STATIC_ASSERT(has_xxx<b6>::value);
|
||||
BOOST_STATIC_ASSERT(has_xxx<b7>::value);
|
||||
|
||||
BOOST_STATIC_ASSERT(!has_xxx<outer<inner<int> > >::value);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user