Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/hana/detail/operators/comparable.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*!
0002 @file
0003 Defines operators for Comparables.
0004 
0005 Copyright Louis Dionne 2013-2022
0006 Distributed under the Boost Software License, Version 1.0.
0007 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
0008  */
0009 
0010 #ifndef BOOST_HANA_DETAIL_OPERATORS_COMPARABLE_HPP
0011 #define BOOST_HANA_DETAIL_OPERATORS_COMPARABLE_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/core/tag_of.hpp>
0015 #include <boost/hana/fwd/equal.hpp>
0016 #include <boost/hana/fwd/not_equal.hpp>
0017 
0018 #include <type_traits>
0019 
0020 
0021 namespace boost { namespace hana { namespace detail {
0022     template <typename Tag>
0023     struct comparable_operators {
0024         static constexpr bool value = false;
0025     };
0026 
0027     namespace operators {
0028         template <typename X, typename Y, typename = typename std::enable_if<
0029             !detail::has_idempotent_tag<X>::value &&
0030             !detail::has_idempotent_tag<Y>::value &&
0031             (detail::comparable_operators<
0032                 typename hana::tag_of<X>::type>::value ||
0033              detail::comparable_operators<
0034                 typename hana::tag_of<Y>::type>::value)
0035         >::type>
0036         constexpr auto operator==(X&& x, Y&& y)
0037         { return hana::equal(static_cast<X&&>(x), static_cast<Y&&>(y)); }
0038 
0039         template <typename X, typename Y, typename = typename std::enable_if<
0040             !detail::has_idempotent_tag<X>::value &&
0041             !detail::has_idempotent_tag<Y>::value &&
0042             (detail::comparable_operators<
0043                 typename hana::tag_of<X>::type>::value ||
0044              detail::comparable_operators<
0045                 typename hana::tag_of<Y>::type>::value)
0046         >::type>
0047         constexpr auto operator!=(X&& x, Y&& y)
0048         { return hana::not_equal(static_cast<X&&>(x), static_cast<Y&&>(y)); }
0049     } // end namespace operators
0050 } }} // end namespace boost::hana
0051 
0052 #endif // !BOOST_HANA_DETAIL_OPERATORS_COMPARABLE_HPP