Warning, file /include/boost/hana/detail/operators/orderable.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_HANA_DETAIL_OPERATORS_ORDERABLE_HPP
0011 #define BOOST_HANA_DETAIL_OPERATORS_ORDERABLE_HPP
0012
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/core/tag_of.hpp>
0015 #include <boost/hana/fwd/greater.hpp>
0016 #include <boost/hana/fwd/greater_equal.hpp>
0017 #include <boost/hana/fwd/less.hpp>
0018 #include <boost/hana/fwd/less_equal.hpp>
0019
0020 #include <type_traits>
0021
0022
0023 namespace boost { namespace hana { namespace detail {
0024 template <typename Tag>
0025 struct orderable_operators {
0026 static constexpr bool value = false;
0027 };
0028
0029 namespace operators {
0030 template <typename X, typename Y, typename = typename std::enable_if<
0031 detail::orderable_operators<typename hana::tag_of<X>::type>::value ||
0032 detail::orderable_operators<typename hana::tag_of<Y>::type>::value
0033 >::type>
0034 constexpr auto operator<(X&& x, Y&& y)
0035 { return hana::less(static_cast<X&&>(x), static_cast<Y&&>(y)); }
0036
0037 template <typename X, typename Y, typename = typename std::enable_if<
0038 detail::orderable_operators<typename hana::tag_of<X>::type>::value ||
0039 detail::orderable_operators<typename hana::tag_of<Y>::type>::value
0040 >::type>
0041 constexpr auto operator>(X&& x, Y&& y)
0042 { return hana::greater(static_cast<X&&>(x), static_cast<Y&&>(y)); }
0043
0044 template <typename X, typename Y, typename = typename std::enable_if<
0045 detail::orderable_operators<typename hana::tag_of<X>::type>::value ||
0046 detail::orderable_operators<typename hana::tag_of<Y>::type>::value
0047 >::type>
0048 constexpr auto operator<=(X&& x, Y&& y)
0049 { return hana::less_equal(static_cast<X&&>(x), static_cast<Y&&>(y)); }
0050
0051 template <typename X, typename Y, typename = typename std::enable_if<
0052 detail::orderable_operators<typename hana::tag_of<X>::type>::value ||
0053 detail::orderable_operators<typename hana::tag_of<Y>::type>::value
0054 >::type>
0055 constexpr auto operator>=(X&& x, Y&& y)
0056 { return hana::greater_equal(static_cast<X&&>(x), static_cast<Y&&>(y)); }
0057 }
0058 } }}
0059
0060 #endif