/usr/include/boost/iterator
Edit: /usr/include/boost/iterator/minimum_category.hpp (2256B)
// 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 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
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
{
};
};
} // namespace detail
//
// Returns the minimum category type or fails to compile
// if T1 and T2 are unrelated.
//
template
struct minimum_category
{
typedef boost::iterators::detail::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 iterators
} // namespace boost
#endif // BOOST_ITERATOR_MINIMUM_CATEGORY_HPP_INCLUDED_