Ginkgo Generated from branch based on main. Ginkgo version 1.10.0
A numerical linear algebra library targeting many-core architectures
Loading...
Searching...
No Matches
std_extensions.hpp
1// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
5#ifndef GKO_PUBLIC_CORE_BASE_STD_EXTENSIONS_HPP_
6#define GKO_PUBLIC_CORE_BASE_STD_EXTENSIONS_HPP_
7
8
9#include <exception>
10#include <functional>
11#include <memory>
12#include <type_traits>
13
14#include "ginkgo/core/base/types.hpp"
15
16
17// This header provides implementations of useful utilities introduced into the
18// C++ standard after C++14 (e.g. C++17 and C++20).
19// For documentation about these utilities refer to the newer version of the
20// standard.
21
22
23namespace gko {
29namespace xstd {
30namespace detail {
31
32
33template <typename... Ts>
34struct make_void {
35 using type = void;
36};
37
38
39} // namespace detail
40
41
46template <typename... Ts>
47using void_t = typename detail::make_void<Ts...>::type;
48
49
50GKO_DEPRECATED("use std::uncaught_exceptions")
51inline bool uncaught_exception() noexcept
52{
53 return std::uncaught_exceptions() > 0;
54}
55
56
57// Kept for backward compatibility.
58template <bool B, typename T = void>
59using enable_if_t = std::enable_if_t<B, T>;
60
61
62// Kept for backward compatibility.
63template <bool B, typename T, typename F>
64using conditional_t = std::conditional_t<B, T, F>;
65
66
67// Kept for backward compatibility.
68template <typename T>
69using decay_t = std::decay_t<T>;
70
71
72// Kept for backward compatibility.
73template <typename T>
74constexpr bool greater(const T&& lhs, const T&& rhs)
75{
76 return std::greater<void>()(lhs, rhs);
77}
78
79
80// Kept for backward compatibility.
81template <typename T>
82constexpr bool greater_equal(const T&& lhs, const T&& rhs)
83{
84 return std::greater_equal<void>()(lhs, rhs);
85}
86
87
88// Kept for backward compatibility.
89template <typename T>
90constexpr bool less(const T&& lhs, const T&& rhs)
91{
92 return std::less<void>()(lhs, rhs);
93}
94
95
96// Kept for backward compatibility.
97template <typename T>
98constexpr bool less_equal(const T&& lhs, const T&& rhs)
99{
100 return std::less_equal<void>()(lhs, rhs);
101}
102
103
104template <class... Ts>
105using conjunction = std::conjunction<Ts...>;
106
107
108// Provide the type_identity from C++20
109template <typename T>
111 using type = T;
112};
113
114template <typename T>
115using type_identity_t = typename type_identity<T>::type;
116
117
118} // namespace xstd
119} // namespace gko
120
121
122#endif // GKO_PUBLIC_CORE_BASE_STD_EXTENSIONS_HPP_
@ rhs
the input is right hand side
Definition solver_base.hpp:41
The namespace for functionalities after C++14 standard.
Definition std_extensions.hpp:29
typename detail::make_void< Ts... >::type void_t
Use the custom implementation, since the std::void_t used in is_matrix_type_builder seems to trigger ...
Definition std_extensions.hpp:47
The Ginkgo namespace.
Definition abstract_factory.hpp:20
Definition std_extensions.hpp:110