From 8fe632d6b14e8fc2f5d7979c62db7845706cc838 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sat, 19 Jul 2014 21:03:11 +0400 Subject: [PATCH] Copied minimum_category.hpp to public headers. --- .../iterator/detail/minimum_category.hpp | 90 +-------------- include/boost/iterator/minimum_category.hpp | 103 ++++++++++++++++++ 2 files changed, 106 insertions(+), 87 deletions(-) create mode 100644 include/boost/iterator/minimum_category.hpp diff --git a/include/boost/iterator/detail/minimum_category.hpp b/include/boost/iterator/detail/minimum_category.hpp index 68a41a5..cd10601 100644 --- a/include/boost/iterator/detail/minimum_category.hpp +++ b/include/boost/iterator/detail/minimum_category.hpp @@ -4,96 +4,12 @@ #ifndef MINIMUM_CATEGORY_DWA20031119_HPP # define MINIMUM_CATEGORY_DWA20031119_HPP -# include -# include - -# include +# include namespace boost { -namespace iterators { -namespace detail { -// -// Returns the minimum category type or error_type -// if T1 and T2 are unrelated. -// -// For compilers not supporting is_convertible this only -// works with the new boost return and traversal category -// types. The exact boost _types_ are required. No derived types -// will work. -// -// -template -struct minimum_category_impl; -template -struct error_not_related_by_convertibility; - -template <> -struct minimum_category_impl -{ - template struct apply - { - typedef T2 type; - }; -}; - -template <> -struct minimum_category_impl -{ - template struct apply - { - typedef T1 type; - }; -}; - -template <> -struct minimum_category_impl -{ - template struct apply - { - BOOST_STATIC_ASSERT((is_same::value)); - typedef T1 type; - }; -}; - -template <> -struct minimum_category_impl -{ - template struct apply - : error_not_related_by_convertibility - { - }; -}; - -template -struct minimum_category -{ - typedef minimum_category_impl< - ::boost::is_convertible::value - , ::boost::is_convertible::value - > outer; - - typedef typename outer::template apply inner; - typedef typename inner::type type; - - BOOST_MPL_AUX_LAMBDA_SUPPORT(2,minimum_category,(T1,T2)) -}; - -template <> -struct minimum_category -{ - template - struct apply : minimum_category - {}; - - BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,minimum_category,(mpl::_1,mpl::_2)) -}; - -} // namespace detail -} // namespace iterators - -// This import below is for backward compatibility with boost/token_iterator.hpp. -// It should be removed as soon as that header is fixed. +// This import below (as well as the whole header) is for backward compatibility +// with boost/token_iterator.hpp. It should be removed as soon as that header is fixed. namespace detail { using iterators::detail::minimum_category; } // namespace detail diff --git a/include/boost/iterator/minimum_category.hpp b/include/boost/iterator/minimum_category.hpp new file mode 100644 index 0000000..68a41a5 --- /dev/null +++ b/include/boost/iterator/minimum_category.hpp @@ -0,0 +1,103 @@ +// Copyright David Abrahams 2003. Use, modification and distribution is +// subject to 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) +#ifndef MINIMUM_CATEGORY_DWA20031119_HPP +# define MINIMUM_CATEGORY_DWA20031119_HPP + +# include +# include + +# include + +namespace boost { +namespace iterators { +namespace detail { +// +// Returns the minimum category type or error_type +// if T1 and T2 are unrelated. +// +// For compilers not supporting is_convertible this only +// works with the new boost return and traversal category +// types. The exact boost _types_ are required. No derived types +// will work. +// +// +template +struct minimum_category_impl; + +template +struct error_not_related_by_convertibility; + +template <> +struct minimum_category_impl +{ + template struct apply + { + typedef T2 type; + }; +}; + +template <> +struct minimum_category_impl +{ + template struct apply + { + typedef T1 type; + }; +}; + +template <> +struct minimum_category_impl +{ + template struct apply + { + BOOST_STATIC_ASSERT((is_same::value)); + typedef T1 type; + }; +}; + +template <> +struct minimum_category_impl +{ + template struct apply + : error_not_related_by_convertibility + { + }; +}; + +template +struct minimum_category +{ + typedef minimum_category_impl< + ::boost::is_convertible::value + , ::boost::is_convertible::value + > outer; + + typedef typename outer::template apply inner; + typedef typename inner::type type; + + BOOST_MPL_AUX_LAMBDA_SUPPORT(2,minimum_category,(T1,T2)) +}; + +template <> +struct minimum_category +{ + template + struct apply : minimum_category + {}; + + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,minimum_category,(mpl::_1,mpl::_2)) +}; + +} // namespace detail +} // namespace iterators + +// This import below is for backward compatibility with boost/token_iterator.hpp. +// It should be removed as soon as that header is fixed. +namespace detail { +using iterators::detail::minimum_category; +} // namespace detail + +} // namespace boost + +#endif // MINIMUM_CATEGORY_DWA20031119_HPP