From 8ff8efdba774bbbc3edc13534a6aaad82e5eaf95 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Sun, 15 Sep 2002 18:46:21 +0000 Subject: [PATCH] Another bugfix [SVN r15336] --- include/boost/type_traits/function_traits.hpp | 144 +----------------- 1 file changed, 6 insertions(+), 138 deletions(-) diff --git a/include/boost/type_traits/function_traits.hpp b/include/boost/type_traits/function_traits.hpp index 2ec084b..2f6ac7b 100644 --- a/include/boost/type_traits/function_traits.hpp +++ b/include/boost/type_traits/function_traits.hpp @@ -10,145 +10,13 @@ // This software is provided "as is" without express or implied warranty, // and with no claim as to its suitability for any purpose. -#ifndef BOOST_FUNCTION_TYPE_TRAITS_HPP -#define BOOST_FUNCTION_TYPE_TRAITS_HPP +#ifndef BOOST_TT_FUNCTION_TRAITS_HPP_INCLUDED +#define BOOST_TT_FUNCTION_TRAITS_HPP_INCLUDED -#ifndef BOOST_ICE_TYPE_TRAITS_HPP -#include -#endif -#ifndef BOOST_FWD_TYPE_TRAITS_HPP -#include -#endif -#ifndef BOOST_COMPOSITE_TYPE_TRAITS_HPP -#include -#endif -// -// is a type a function? -// Please note that this implementation is unnecessarily complex: -// we could just use !is_convertible::value, -// except that some compilers erroneously allow conversions from -// function pointers to void*. -// -namespace boost{ -namespace detail{ - -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = false); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template -struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; - -template -struct is_function_helper : is_function_helper_base{}; - -#else - -template -struct is_function_helper -{ - static T* t; - BOOST_STATIC_CONSTANT(bool, value = sizeof(is_function_tester(t)) == sizeof(::boost::type_traits::yes_type)); - //BOOST_STATIC_CONSTANT(bool, value = (!::boost::is_convertible::value)); -}; - -#endif - -template -struct is_function_ref_helper -{ - BOOST_STATIC_CONSTANT(bool, value = false); -}; - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) -template -struct is_function_chooser -{ - typedef is_function_helper type; -}; -template -struct is_function_chooser -{ - typedef is_function_ref_helper type; -}; -#endif -} // namespace detail - -template -struct is_function -{ -private: -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - typedef typename detail::is_function_chooser::value>::type m_type; -#else - // without partial specialistaion we can't use is_reference on - // function types, that leaves this template broken in the case that - // T is a reference: - typedef detail::is_function_helper m_type; -#endif -public: - BOOST_STATIC_CONSTANT(bool, value = m_type::value); -}; +#include "boost/type_traits/is_function.hpp" #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +namespace boost { namespace detail { template struct function_traits_helper; @@ -361,6 +229,6 @@ struct function_traits }; #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -} // boost +} -#endif // BOOST_FUNCTION_TYPE_TRAITS_HPP +#endif // BOOST_TT_FUNCTION_TRAITS_HPP_INCLUDED