1/*!
2@file
3Defines `boost::hana::ordering`.
4
5Copyright Louis Dionne 2013-2022
6Distributed under the Boost Software License, Version 1.0.
7(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
8 */
9
10#ifndef BOOST_HANA_ORDERING_HPP
11#define BOOST_HANA_ORDERING_HPP
12
13#include <boost/hana/fwd/ordering.hpp>
14
15#include <boost/hana/config.hpp>
16#include <boost/hana/detail/decay.hpp>
17#include <boost/hana/less.hpp>
18
19
20namespace boost { namespace hana {
21 namespace detail {
22 template <typename F>
23 struct less_by {
24 F f;
25
26 template <typename X, typename Y>
27 constexpr decltype(auto) operator()(X&& x, Y&& y) const&
28 { return hana::less(f(static_cast<X&&>(x)), f(static_cast<Y&&>(y))); }
29
30 template <typename X, typename Y>
31 constexpr decltype(auto) operator()(X&& x, Y&& y) &
32 { return hana::less(f(static_cast<X&&>(x)), f(static_cast<Y&&>(y))); }
33 };
34 }
35
36 //! @cond
37 template <typename F>
38 constexpr auto ordering_t::operator()(F&& f) const {
39 return detail::less_by<typename detail::decay<F>::type>{static_cast<F&&>(f)};
40 }
41 //! @endcond
42}} // end namespace boost::hana
43
44#endif // !BOOST_HANA_ORDERING_HPP
45

source code of boost/libs/hana/include/boost/hana/ordering.hpp