From 3d45932549339dd29a7975ea255399807199efdd Mon Sep 17 00:00:00 2001 From: John Maddock Date: Sun, 20 Jan 2002 12:22:23 +0000 Subject: [PATCH] Fixed is_convertible to work with cv-void types. [SVN r12367] --- .../boost/type_traits/conversion_traits.hpp | 144 +++++++++++++----- 1 file changed, 105 insertions(+), 39 deletions(-) diff --git a/include/boost/type_traits/conversion_traits.hpp b/include/boost/type_traits/conversion_traits.hpp index 486bc72..27860f6 100644 --- a/include/boost/type_traits/conversion_traits.hpp +++ b/include/boost/type_traits/conversion_traits.hpp @@ -25,9 +25,6 @@ #ifndef BOOST_ARITHMETIC_TYPE_TRAITS_HPP #include #endif -#ifndef BOOST_SAME_TRAITS_HPP -#include -#endif // // is one type convertable to another? // @@ -129,22 +126,6 @@ public: static const bool value = is_convertible_helper::value; }; -template -struct is_convertible -{ - static const bool value = false; -}; -template -struct is_convertible -{ - static const bool value = false; -}; -template <> -struct is_convertible -{ - static const bool value = true; -}; - #elif defined(__GNUC__) // // special version for gcc compiler @@ -175,22 +156,6 @@ public: void foo(); // avoid warning about all members being private }; -template -struct is_convertible -{ - static const bool value = false; -}; -template -struct is_convertible -{ - static const bool value = false; -}; -template <> -struct is_convertible -{ - static const bool value = true; -}; - #else template @@ -211,28 +176,129 @@ template const bool is_convertible::value; #endif + +#endif // is_convertible + +// +// Now add the full and partial specialisations +// for void types, these are common to all the +// implementation above: +// #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template struct is_convertible { BOOST_STATIC_CONSTANT(bool, value = false); }; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +#endif // BOOST_NO_CV_VOID_SPECIALIZATIONS template struct is_convertible { BOOST_STATIC_CONSTANT(bool, value = false); }; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +#endif +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template <> struct is_convertible { BOOST_STATIC_CONSTANT(bool, value = true); }; -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -#endif // is_convertible - +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +#endif } // namespace boost