--- /dev/null 2006-02-24 11:01:30.000000000 -0500 +++ boost/mpl/has_template_xxx.hpp 2007-03-16 16:27:46.000000000 -0400 @@ -0,0 +1,81 @@ + +#ifndef BOOST_MPL_HAS_TEMPLATE_XXX_HPP_INCLUDED +#define BOOST_MPL_HAS_TEMPLATE_XXX_HPP_INCLUDED + +// 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) + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#if !defined(BOOST_MPL_CFG_NO_HAS_TEMPLATE_XXX) + +// Create boolean unary Metafunction to detect a nested template +// members with n template parameters. This implementation is based on +// the implementation of BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF from David +// Abrahams and Aleksey Gurtovoy. +# define BOOST_MPL_HAS_TEMPLATE_XXX_TRAIT_NAMED_DEF(trait, name, n, default_) \ +template > \ +struct trait { \ + struct gcc_3_2_wknd \ + { \ + template< typename U > \ + static boost::mpl::aux::yes_tag test( \ + boost::mpl::aux::type_wrapper const volatile* \ + , boost::mpl::aux::type_wrapper< \ + BOOST_MSVC_TYPENAME U::template name< \ + BOOST_PP_ENUM_PARAMS(n, U) \ + > \ + >* = 0 \ + ); \ + \ + static boost::mpl::aux::no_tag test(...); \ + }; \ + \ + typedef boost::mpl::aux::type_wrapper t_; \ + BOOST_STATIC_CONSTANT(bool, value = \ + sizeof(gcc_3_2_wknd::test(static_cast(0))) \ + == sizeof(boost::mpl::aux::yes_tag) \ + ); \ + typedef boost::mpl::bool_ type; \ +}; \ +/**/ + +#else // BOOST_MPL_CFG_NO_HAS_TEMPLATE_XXX + +// placeholder implementation + +# define BOOST_MPL_HAS_TEMPLATE_XXX_TRAIT_NAMED_DEF(trait, name, n, default_) \ +template< typename T \ + BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, typename U) \ + , typename fallback_ = boost::mpl::bool_ > \ +struct trait \ +{ \ + BOOST_STATIC_CONSTANT(bool, value = fallback_::value); \ + typedef fallback_ type; \ +}; \ +/**/ + +#endif // BOOST_MPL_CFG_NO_HAS_TEMPLATE_XXX + +# define BOOST_MPL_HAS_TEMPLATE_XXX_TRAIT_DEF(name, n) \ + BOOST_MPL_HAS_TEMPLATE_XXX_TRAIT_NAMED_DEF( \ + BOOST_PP_CAT(has_template_, name), name, n, false \ + ) \ +/**/ + +#endif // BOOST_MPL_HAS_TEMPLATE_XXX_HPP_INCLUDED --- /dev/null 2006-02-24 11:01:30.000000000 -0500 +++ boost/mpl/aux_/config/has_template_xxx.hpp 2007-03-16 15:58:30.000000000 -0400 @@ -0,0 +1,26 @@ + +#ifndef BOOST_MPL_AUX_CONFIG_HAS_TEMPLATE_XXX_HPP_INCLUDED +#define BOOST_MPL_AUX_CONFIG_HAS_TEMPLATE_XXX_HPP_INCLUDED + +// 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) + +#include +#include + +#if !defined(BOOST_MPL_CFG_NO_HAS_TEMPLATE_XXX) \ + && ( defined(BOOST_MPL_CFG_BROKEN_OVERLOAD_RESOLUTION) \ + || BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \ + || BOOST_WORKAROUND(__IBMCPP__, <= 700) \ + || BOOST_WORKAROUND(__GNUC__, <= 2) \ + || BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) \ + ) + +# define BOOST_MPL_CFG_NO_HAS_TEMPLATE_XXX + +#endif // BOOST_MPL_CFG_NO_HAS_TEMPLATE_XXX + +#endif // BOOST_MPL_AUX_CONFIG_HAS_TEMPLATE_XXX_HPP_INCLUDED