Skip to content

Commit 9199dcc

Browse files
committed
Remove __monostate from future's completion variant
Since the stdexec-specific `__variant` type has an uninitialized state, we don't need the `__monostate` variant option to represent "uninitialized". Delete it.
1 parent afd6e39 commit 9199dcc

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

‎include/stdexec/__detail/__spawn_future.hpp‎

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,12 @@ namespace STDEXEC {
6666
template <bool _NothrowStorable, class... _Sigs>
6767
struct __future_variant {
6868
// this case handles _NothrowStorable == true
69-
using type =
70-
__uniqued_variant<__monostate, __decayed_tuple<set_stopped_t>, __as_tuple<_Sigs>...>;
69+
using type = __uniqued_variant<__decayed_tuple<set_stopped_t>, __as_tuple<_Sigs>...>;
7170
};
7271

7372
template <class... _Sigs>
7473
struct __future_variant<false, _Sigs...> {
7574
using type = __uniqued_variant<
76-
__monostate,
7775
__decayed_tuple<set_stopped_t>,
7876
__decayed_tuple<set_error_t, std::exception_ptr>,
7977
__as_tuple<_Sigs>...
@@ -166,7 +164,6 @@ namespace STDEXEC {
166164
void (*__complete)(__spawn_future_state_base*) noexcept) noexcept
167165
: __try_cancelable(__try_cancel)
168166
, __complete_(__complete) {
169-
__result_.template emplace<__monostate>();
170167
}
171168

172169
__spawn_future_state_base(__spawn_future_state_base&&) = delete;
@@ -400,13 +397,11 @@ namespace STDEXEC {
400397
void __do_consume(auto& __rcvr) noexcept {
401398
__visit(
402399
[&__rcvr](auto&& __tuple) noexcept {
403-
if constexpr (!__same_as<std::remove_reference_t<decltype(__tuple)>, __monostate>) {
404-
__apply(
405-
[&__rcvr](auto cpo, auto&&... __vals) {
406-
cpo(std::move(__rcvr), std::move(__vals)...);
407-
},
408-
std::move(__tuple)); // NOLINT(bugprone-move-forwarding-reference)
409-
}
400+
__apply(
401+
[&__rcvr](auto cpo, auto&&... __vals) {
402+
cpo(std::move(__rcvr), std::move(__vals)...);
403+
},
404+
std::move(__tuple)); // NOLINT(bugprone-move-forwarding-reference)
410405
},
411406
std::move(this->__result_));
412407
}

0 commit comments

Comments
 (0)