Pack required boost code together.
[xy_vsfilter.git] / src / thirdparty / boost_1_47_0 / boost / iterator / detail / minimum_category.hpp
blob804f9186f05d9883734b50592918b4d42b9b90b8
1 // Copyright David Abrahams 2003. Use, modification and distribution is
2 // subject to the Boost Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4 #ifndef MINIMUM_CATEGORY_DWA20031119_HPP
5 # define MINIMUM_CATEGORY_DWA20031119_HPP
7 # include <boost/type_traits/is_convertible.hpp>
8 # include <boost/type_traits/is_same.hpp>
10 # include <boost/mpl/aux_/lambda_support.hpp>
12 namespace boost { namespace detail {
14 // Returns the minimum category type or error_type
15 // if T1 and T2 are unrelated.
17 // For compilers not supporting is_convertible this only
18 // works with the new boost return and traversal category
19 // types. The exact boost _types_ are required. No derived types
20 // will work.
23 template <bool GreaterEqual, bool LessEqual>
24 struct minimum_category_impl
25 # if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
27 template <class T1, class T2> struct apply
29 typedef T2 type;
31 typedef void type;
33 # endif
36 template <class T1, class T2>
37 struct error_not_related_by_convertibility;
39 template <>
40 struct minimum_category_impl<true,false>
42 template <class T1, class T2> struct apply
44 typedef T2 type;
48 template <>
49 struct minimum_category_impl<false,true>
51 template <class T1, class T2> struct apply
53 typedef T1 type;
57 template <>
58 struct minimum_category_impl<true,true>
60 template <class T1, class T2> struct apply
62 BOOST_STATIC_ASSERT((is_same<T1,T2>::value));
63 typedef T1 type;
67 template <>
68 struct minimum_category_impl<false,false>
70 template <class T1, class T2> struct apply
71 : error_not_related_by_convertibility<T1,T2>
76 template <class T1 = mpl::_1, class T2 = mpl::_2>
77 struct minimum_category
79 typedef minimum_category_impl<
80 # if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // ETI workaround
81 is_same<T2,int>::value ||
82 # endif
83 ::boost::is_convertible<T1,T2>::value
84 , ::boost::is_convertible<T2,T1>::value
85 # if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // ETI workaround
86 || is_same<T1,int>::value
87 # endif
88 > outer;
90 typedef typename outer::template apply<T1,T2> inner;
91 typedef typename inner::type type;
93 BOOST_MPL_AUX_LAMBDA_SUPPORT(2,minimum_category,(T1,T2))
96 template <>
97 struct minimum_category<mpl::_1,mpl::_2>
99 template <class T1, class T2>
100 struct apply : minimum_category<T1,T2>
103 BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,minimum_category,(mpl::_1,mpl::_2))
106 # if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // ETI workaround
107 template <>
108 struct minimum_category<int,int>
110 typedef int type;
112 # endif
114 }} // namespace boost::detail
116 #endif // MINIMUM_CATEGORY_DWA20031119_HPP