diff --git a/include/boost/iterator/minimum_category.hpp b/include/boost/iterator/minimum_category.hpp index 913cec4..7b16d61 100644 --- a/include/boost/iterator/minimum_category.hpp +++ b/include/boost/iterator/minimum_category.hpp @@ -2,61 +2,35 @@ // 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 BOOST_ITERATOR_MINIMUM_CATEGORY_HPP_INCLUDED_ -# define BOOST_ITERATOR_MINIMUM_CATEGORY_HPP_INCLUDED_ +#define BOOST_ITERATOR_MINIMUM_CATEGORY_HPP_INCLUDED_ -# include - -# include -# include +#include +#include namespace boost { namespace iterators { namespace detail { -template +template struct minimum_category_impl; template -struct error_not_related_by_convertibility; - -template <> -struct minimum_category_impl +struct minimum_category_impl { - template struct apply - { - typedef T2 type; - }; + using type = T2; }; -template <> -struct minimum_category_impl +template +struct minimum_category_impl { - template struct apply - { - typedef T1 type; - }; + using type = T1; }; -template <> -struct minimum_category_impl +template +struct minimum_category_impl { - template struct apply - { - static_assert( - std::is_same::value, - "Iterator category types must be the same when they are equivalent." - ); - typedef T1 type; - }; -}; - -template <> -struct minimum_category_impl -{ - template struct apply - : error_not_related_by_convertibility - { - }; + static_assert(std::is_same::value, "Iterator category types must be the same when they are equivalent."); + using type = T1; }; } // namespace detail @@ -65,32 +39,30 @@ struct minimum_category_impl // Returns the minimum category type or fails to compile // if T1 and T2 are unrelated. // -template +template< class T1 = mpl::arg<1>, class T2 = mpl::arg<2> > struct minimum_category { - typedef boost::iterators::detail::minimum_category_impl< - std::is_convertible::value - , std::is_convertible::value - > outer; + static_assert( + std::is_convertible::value || std::is_convertible::value, + "Iterator category types must be related through convertibility."); - typedef typename outer::template apply inner; - typedef typename inner::type type; - - BOOST_MPL_AUX_LAMBDA_SUPPORT(2,minimum_category,(T1,T2)) + using type = typename boost::iterators::detail::minimum_category_impl< + T1, + T2, + std::is_convertible::value, + std::is_convertible::value + >::type; }; template <> -struct minimum_category +struct minimum_category< mpl::arg<1>, mpl::arg<2> > { template - struct apply : minimum_category + struct apply : minimum_category {}; - - BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,minimum_category,(mpl::_1,mpl::_2)) }; } // namespace iterators - } // namespace boost #endif // BOOST_ITERATOR_MINIMUM_CATEGORY_HPP_INCLUDED_