kokkos-execution
0.0.1
Toggle main menu visibility
Loading...
Searching...
No Matches
compile_time_optional.hpp
Go to the documentation of this file.
1
#ifndef KOKKOS_EXECUTION_IMPL_COMPILE_TIME_OPTIONAL_HPP
2
#define KOKKOS_EXECUTION_IMPL_COMPILE_TIME_OPTIONAL_HPP
3
4
#include <concepts>
5
#include <type_traits>
6
#include <utility>
7
8
namespace
Kokkos::Execution::Impl
{
9
16
template
<
bool
Enabled,
typename
T>
17
struct
CompileTimeOptional
;
18
19
template
<
typename
T>
20
struct
CompileTimeOptional
<false, T> {
21
using
value_type
= T;
22
23
constexpr
CompileTimeOptional
() noexcept = default;
24
26
template <typename... Args>
27
requires(!(sizeof...(Args) == 1 && (std::same_as<std::remove_cvref_t<Args>,
CompileTimeOptional
> && ...)))
28
constexpr explicit
CompileTimeOptional
(Args&&...) noexcept {
29
}
30
};
31
32
template
<
typename
T>
33
struct
CompileTimeOptional
<true, T> {
34
using
value_type
= T;
35
36
template
<
typename
... Args>
37
requires
(
38
std::constructible_from<T, Args...>
39
&& !(
sizeof
...(Args) == 1 && (std::same_as<std::remove_cvref_t<Args>,
CompileTimeOptional
> && ...)))
40
constexpr
explicit
CompileTimeOptional
(Args&&... args)
noexcept
(std::is_nothrow_constructible_v<T, Args&&...>)
41
:
value
(std::forward<Args>(args)...) {
42
}
43
44
T
value
;
45
};
46
47
}
// namespace Kokkos::Execution::Impl
48
49
#endif
// KOKKOS_EXECUTION_IMPL_COMPILE_TIME_OPTIONAL_HPP
Kokkos::Execution::Impl
Definition
attributes.hpp:6
Kokkos::Execution::Impl::CompileTimeOptional< false, T >::value_type
T value_type
Definition
compile_time_optional.hpp:21
Kokkos::Execution::Impl::CompileTimeOptional< false, T >::CompileTimeOptional
constexpr CompileTimeOptional() noexcept=default
Kokkos::Execution::Impl::CompileTimeOptional< true, T >::value
T value
Definition
compile_time_optional.hpp:44
Kokkos::Execution::Impl::CompileTimeOptional< true, T >::CompileTimeOptional
constexpr CompileTimeOptional(Args &&... args) noexcept(std::is_nothrow_constructible_v< T, Args &&... >)
Definition
compile_time_optional.hpp:40
Kokkos::Execution::Impl::CompileTimeOptional< true, T >::value_type
T value_type
Definition
compile_time_optional.hpp:34
Kokkos::Execution::Impl::CompileTimeOptional
Compile-time optional value that holds a T when Enabled, is an empty type otherwise.
Definition
compile_time_optional.hpp:17
kokkos-execution
impl
compile_time_optional.hpp
Generated on
for kokkos-execution by
1.18.0