tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
synth_three_way.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2021 Tobias Hienzsch
3
4#ifndef TETL_COMPARE_SYNTH_THREE_WAY_HPP
5#define TETL_COMPARE_SYNTH_THREE_WAY_HPP
6
7#include <etl/_compare/weak_ordering.hpp>
8#include <etl/_concepts/boolean_testable.hpp>
9#include <etl/_type_traits/declval.hpp>
10
11namespace etl {
12
13// // clang-format off
14// inline constexpr auto synth_three_way =
15// []<typename T, typename U>(T const& t, U const& u)
16// requires requires {
17// { t < u } -> boolean_testable;
18// { u < t } -> boolean_testable;
19// }
20// {
21// if constexpr (three_way_comparable_with<T, U>) {
22// return t <=> u;
23// } else {
24// if (t < u) { return weak_ordering::less; }
25// if (u < t) { return weak_ordering::greater; }
26// return weak_ordering::equivalent;
27// }
28// };
29// // clang-format on
30
31// template <typename T, typename U = T>
32// using synth_three_way_result
33// = decltype(synth_three_way(declval<T&>(), declval<U&>()));
34
35} // namespace etl
36
37#endif // TETL_COMPARE_SYNTH_THREE_WAY_HPP
Definition adjacent_find.hpp:9