// Copyright Aleksey Gurtovoy 2000-2004 // Copyright Daniel Walker 2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/mpl for documentation. // $Id$ // $Date$ // $Revision$ #include #include #include BOOST_MPL_HAS_XXX_TRAIT_DEF(xxx) BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF(has_xxx_template, xxx, false) BOOST_MPL_HAS_XXX_TEMPLATE_DEF(yyy) struct a1 {}; struct a2 { void xxx(); }; struct a3 { int xxx; }; struct a4 { static int xxx(); }; struct a5 { template< typename T > struct xxx {}; }; struct b1 { typedef int xxx; }; struct b2 { struct xxx; }; struct b3 { typedef int& xxx; }; struct b4 { typedef int* xxx; }; struct b5 { typedef int xxx[10]; }; struct b6 { typedef void (*xxx)(); }; struct b7 { typedef void (xxx)(); }; struct c1 { template< typename T > struct xxx {}; }; struct c2 { template< typename T1, typename T2 > struct xxx {}; }; struct c3 { template< typename T1, typename T2, typename T3 > struct xxx {}; }; struct c4 { template< typename T1, typename T2, typename T3, typename T4 > struct xxx {}; }; struct c5 { template< typename T1, typename T2, typename T3, typename T4, typename T5 > struct xxx {}; }; struct c6 { template< typename T > struct yyy {}; }; struct c7 { template< typename T1, typename T2 > struct yyy {}; }; template< typename T > struct outer; template< typename T > struct inner { typedef typename T::type type; }; // agurt, 15/aug/04: make sure MWCW passes the test in presence of the following // template template< typename T > struct xxx; MPL_TEST_CASE() { MPL_ASSERT_NOT(( has_xxx )); MPL_ASSERT_NOT(( has_xxx_template )); #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) MPL_ASSERT_NOT(( has_xxx )); MPL_ASSERT_NOT(( has_xxx_template )); MPL_ASSERT_NOT(( has_xxx )); MPL_ASSERT_NOT(( has_xxx_template )); MPL_ASSERT_NOT(( has_xxx )); MPL_ASSERT_NOT(( has_xxx_template )); MPL_ASSERT_NOT(( has_xxx )); MPL_ASSERT_NOT(( has_xxx_template )); MPL_ASSERT_NOT(( has_xxx )); MPL_ASSERT_NOT(( has_xxx_template )); MPL_ASSERT_NOT(( has_xxx )); MPL_ASSERT_NOT(( has_xxx_template )); MPL_ASSERT_NOT(( has_xxx )); MPL_ASSERT_NOT(( has_xxx_template )); #if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) MPL_ASSERT_NOT(( has_xxx )); MPL_ASSERT(( has_xxx_template )); #endif MPL_ASSERT_NOT(( has_xxx< enum_ > )); MPL_ASSERT_NOT(( has_xxx_template< enum_ > )); #endif MPL_ASSERT_NOT(( has_xxx )); MPL_ASSERT_NOT(( has_xxx_template )); MPL_ASSERT_NOT(( has_xxx< outer< inner > > )); MPL_ASSERT_NOT(( has_xxx_template< outer< inner > > )); MPL_ASSERT_NOT(( has_xxx< incomplete > )); MPL_ASSERT_NOT(( has_xxx_template< incomplete > )); MPL_ASSERT_NOT(( has_xxx< abstract > )); MPL_ASSERT_NOT(( has_xxx_template< abstract > )); MPL_ASSERT_NOT(( has_xxx< noncopyable > )); MPL_ASSERT_NOT(( has_xxx_template< noncopyable > )); #if !BOOST_WORKAROUND(__COMO_VERSION__, BOOST_TESTED_AT(4308)) MPL_ASSERT_NOT(( has_xxx_template )); MPL_ASSERT_NOT(( has_xxx_template )); MPL_ASSERT_NOT(( has_xxx_template )); MPL_ASSERT_NOT(( has_xxx_template )); MPL_ASSERT_NOT(( has_xxx_template )); MPL_ASSERT_NOT(( has_xxx_template )); MPL_ASSERT_NOT(( has_xxx_template )); #endif // Same name, different args. MPL_ASSERT(( has_xxx_template )); MPL_ASSERT(( has_xxx_template )); MPL_ASSERT(( has_xxx_template )); MPL_ASSERT(( has_xxx_template )); MPL_ASSERT(( has_xxx_template )); MPL_ASSERT(( has_yyy )); MPL_ASSERT(( has_yyy )); // Different name, different args. MPL_ASSERT_NOT(( has_xxx_template )); MPL_ASSERT_NOT(( has_xxx_template )); MPL_ASSERT_NOT(( has_yyy )); MPL_ASSERT_NOT(( has_yyy )); MPL_ASSERT_NOT(( has_yyy )); MPL_ASSERT_NOT(( has_yyy )); MPL_ASSERT_NOT(( has_yyy )); MPL_ASSERT(( has_xxx )); MPL_ASSERT(( has_xxx )); MPL_ASSERT(( has_xxx )); MPL_ASSERT(( has_xxx )); MPL_ASSERT(( has_xxx )); MPL_ASSERT(( has_xxx )); MPL_ASSERT(( has_xxx )); MPL_ASSERT(( has_xxx_template )); #if !defined(HAS_XXX_ASSERT) # define HAS_XXX_ASSERT(x) MPL_ASSERT(x) #endif HAS_XXX_ASSERT(( has_xxx )); HAS_XXX_ASSERT(( has_xxx )); HAS_XXX_ASSERT(( has_xxx )); HAS_XXX_ASSERT(( has_xxx )); HAS_XXX_ASSERT(( has_xxx )); HAS_XXX_ASSERT(( has_xxx )); HAS_XXX_ASSERT(( has_xxx )); #if !defined(HAS_XXX_TEMPLATE_ASSERT) # define HAS_XXX_TEMPLATE_ASSERT(x) MPL_ASSERT(x) #endif HAS_XXX_TEMPLATE_ASSERT(( has_xxx_template )); }