5 #include <libcopp/utils/config/libcopp_build_features.h>
10 #include <type_traits>
11 #if defined(LIBCOPP_MACRO_ENABLE_CONCEPTS) && LIBCOPP_MACRO_ENABLE_CONCEPTS
21 #if defined(LIBCOPP_MACRO_ENABLE_STD_COROUTINE) && LIBCOPP_MACRO_ENABLE_STD_COROUTINE
23 LIBCOPP_COPP_NAMESPACE_BEGIN
25 template <
class TWAITING_CONTAINER>
26 struct LIBCOPP_COPP_API_HEAD_ONLY some_waiting_container_traits {
27 using element_type =
typename std::remove_pointer<decltype(gsl::data(std::declval<TWAITING_CONTAINER>()))>::type;
28 using value_type =
typename std::remove_reference<
29 typename std::decay<decltype(pick_some_reference<
typename std::remove_reference<element_type>::type>::unwrap(
30 std::declval<
typename std::add_lvalue_reference<element_type>::type>()))>::type>::type;
33 # if defined(LIBCOPP_MACRO_ENABLE_CONCEPTS) && LIBCOPP_MACRO_ENABLE_CONCEPTS
34 template <
class TREADY_ELEMENT,
class TWAITING_ELEMENT>
35 concept SomeContainerConvertible =
36 std::same_as<TWAITING_ELEMENT, TREADY_ELEMENT> || std::convertible_to<TWAITING_ELEMENT*, TREADY_ELEMENT*>;
38 template <
class TREADY_ELEMENT,
class TWAITING_ELEMENT>
39 struct LIBCOPP_COPP_API_HEAD_ONLY some_container_convertible
40 : std::enable_if<std::is_same<TWAITING_ELEMENT, TREADY_ELEMENT>::value ||
41 std::is_convertible<TWAITING_ELEMENT*, TREADY_ELEMENT*>::value> {};
44 template <
class TREADY_CONTAINER,
class TWAITING_CONTAINER
45 # if !(defined(LIBCOPP_MACRO_ENABLE_CONCEPTS) && LIBCOPP_MACRO_ENABLE_CONCEPTS)
47 class =
typename some_container_convertible<
52 LIBCOPP_COPP_API_HEAD_ONLY
inline callable_future<promise_status> some(TREADY_CONTAINER&& ready_futures,
54 TWAITING_CONTAINER&& pending_futures)
55 # if defined(LIBCOPP_MACRO_ENABLE_CONCEPTS) && LIBCOPP_MACRO_ENABLE_CONCEPTS
57 requires SomeContainerConvertible<
65 std::forward<TREADY_CONTAINER>(ready_futures), ready_count, &pending_futures);
68 template <
class TREADY_CONTAINER,
class TWAITING_CONTAINER
69 # if !(defined(LIBCOPP_MACRO_ENABLE_CONCEPTS) && LIBCOPP_MACRO_ENABLE_CONCEPTS)
71 class =
typename some_container_convertible<
76 LIBCOPP_COPP_API_HEAD_ONLY
inline callable_future<promise_status> any(TREADY_CONTAINER&& ready_futures,
77 TWAITING_CONTAINER&& pending_futures)
78 # if defined(LIBCOPP_MACRO_ENABLE_CONCEPTS) && LIBCOPP_MACRO_ENABLE_CONCEPTS
80 requires SomeContainerConvertible<
88 std::forward<TREADY_CONTAINER>(ready_futures), 1, &pending_futures);
91 template <
class TREADY_CONTAINER,
class TWAITING_CONTAINER
92 # if !(defined(LIBCOPP_MACRO_ENABLE_CONCEPTS) && LIBCOPP_MACRO_ENABLE_CONCEPTS)
94 class =
typename some_container_convertible<
99 LIBCOPP_COPP_API_HEAD_ONLY
inline callable_future<promise_status> all(TREADY_CONTAINER&& ready_futures,
100 TWAITING_CONTAINER&& pending_futures)
101 # if defined(LIBCOPP_MACRO_ENABLE_CONCEPTS) && LIBCOPP_MACRO_ENABLE_CONCEPTS
103 requires SomeContainerConvertible<
111 std::forward<TREADY_CONTAINER>(ready_futures),
gsl::size(pending_futures), &pending_futures);
114 LIBCOPP_COPP_NAMESPACE_END
constexpr auto size(TCONTAINER &&container) -> decltype(container.size())
std::shared_ptr< cli::cmd_option_value > value_type