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 using Error = T;
51};
52
53template <template <typename...> typename Instance, typename V, typename E>
55 using Value = V;
56 using Error = E;
57};
58
59template <typename T>
61 using Value = T;
62 using Error = T;
63};
64
65template <typename V, typename E>
67 using Value = V;
68 using Error = E;
69};
70
71template <typename V, typename E>
73 using Value = V;
74 using Error = E;
75};
76
77template <typename V, typename E>
79 using Value = V;
80 using Error = E;
81};
82
83} // 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:232
Provides a mechanism to access the result of async operations.
Definition future.hpp:199
Contract< V, E > 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