tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
compare_three_way_result.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_COMMON_THREE_WAY_RESULT_HPP
5#define TETL_COMPARE_COMMON_THREE_WAY_RESULT_HPP
6
7#include <etl/_type_traits/declval.hpp>
8#include <etl/_type_traits/remove_reference.hpp>
9
10namespace etl {
11
12// recommended by Casey Carter
13// see also: https://github.com/microsoft/STL/pull/385#discussion_r357894054
14/// \ingroup compare
15template <typename T, typename U = T>
16using compare_three_way_result_t
17 = decltype(etl::declval<etl::remove_reference_t<T> const&>() <=> etl::declval<etl::remove_reference_t<U> const&>());
18
19/// \ingroup compare
20template <typename T, typename U = T>
22
23/// \ingroup compare
24template <typename T, typename U>
25 requires requires { typename compare_three_way_result_t<T, U>; }
27 using type = compare_three_way_result_t<T, U>;
28};
29
30} // namespace etl
31
32#endif // TETL_COMPARE_COMMON_THREE_WAY_RESULT_HPP
Definition adjacent_find.hpp:9
Definition compare_three_way_result.hpp:21