YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
type_traits_impl.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <yaclib/fwd.hpp>
4
5#include <type_traits>
6
7namespace yaclib::detail {
8
9template <typename...>
10struct Head;
11
12template <typename T, typename... Args>
13struct Head<T, Args...> final {
14 using Type = T;
15};
16
17template <typename Func, typename... Args>
19 static constexpr bool Value = std::is_invocable_v<Func, Args...>;
20};
21
22template <typename Func>
24 static constexpr bool Value = std::is_invocable_v<Func>;
25};
26
27template <typename Func, typename... Args>
28struct Invoke final {
29 using Type = std::invoke_result_t<Func, Args...>;
30};
31
32template <typename Func>
34 using Type = std::invoke_result_t<Func>;
35};
36
37template <template <typename...> typename Instance, typename...>
38struct IsInstantiationOf final {
39 static constexpr bool Value = false;
40};
41
42template <template <typename...> typename Instance, typename... Args>
44 static constexpr bool Value = true;
45};
46
47template <template <typename...> typename Instance, typename T>
49 using Value = T;
50};
51
52template <template <typename...> typename Instance, typename V>
54 using Value = V;
55};
56
57template <template <typename...> typename Instance, typename T>
59 using Value = T;
60 using Trait = T;
61};
62
63template <template <typename...> typename Instance, typename V, typename T>
65 using Value = V;
66 using Trait = T;
67};
68
69template <typename T>
71 using Value = T;
72 using Trait = T;
73};
74
75template <typename V, typename T>
77 using Value = V;
78 using Trait = T;
79};
80
81template <typename V, typename T>
82struct AsyncTypes<Future<V, T>> final {
83 using Value = V;
84 using Trait = T;
85};
86
87template <typename V, typename T>
88struct AsyncTypes<FutureOn<V, T>> final {
89 using Value = V;
90 using Trait = T;
91};
92
93template <typename V, typename T>
95 using Value = V;
96 using Trait = T;
97};
98
99template <typename V, typename T>
101 using Value = V;
102 using Trait = T;
103};
104
105template <typename V, typename T>
107 using Value = V;
108 using Trait = T;
109};
110
111} // namespace yaclib::detail
Provides a mechanism to access the result of async operations.
Definition future.hpp:20
Provides a mechanism to access the result of async operations.
Definition future.hpp:247
Provides a mechanism to access the result of async operations.
Definition future.hpp:213
Contract< V, T > MakeContract()
Creates related future and promise.
Definition contract.hpp:25
std::invoke_result_t< Func > Type
std::invoke_result_t< Func, Args... > Type
static constexpr bool Value