File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ public:
5151
5252 template <typename ... U>
5353 void return_value (U&&... value) {
54- _promise.set_value (std::forward<U>(value)...);
54+ _promise.set_value (non_explicit_tag{}, std::forward<U>(value)...);
5555 }
5656
5757 void return_value (coroutine::exception ce) noexcept {
Original file line number Diff line number Diff line change @@ -282,6 +282,9 @@ struct get0_return_type {
282282template <typename T>
283283using maybe_wrap_ref = std::conditional_t <std::is_reference_v<T>, std::reference_wrapper<std::remove_reference_t <T>>, T>;
284284
285+ struct non_explicit_tag {};
286+
287+
285288// / \brief Wrapper for keeping uninitialized values of non default constructible types.
286289// /
287290// / This is similar to a std::optional<T>, but it doesn't know if it is holding a value or not, so the user is
@@ -302,8 +305,16 @@ struct uninitialized_wrapper_base<T, false> {
302305 maybe_wrap_ref<T> value;
303306 } _v;
304307
308+ template <typename U>
309+ static T make_implicitly (U&& v) {
310+ return std::forward<U>(v);
311+ }
305312public:
306313 uninitialized_wrapper_base () noexcept = default ;
314+ template <typename U>
315+ void uninitialized_set (non_explicit_tag, U&& v) {
316+ new (&_v.value ) maybe_wrap_ref<T>(make_implicitly (std::forward<U>(v)));
317+ }
307318 template <typename ... U>
308319 std::enable_if_t <!std::is_same_v<std::tuple<std::remove_cv_t <U>...>, std::tuple<tuple_type>>, void >
309320 uninitialized_set (U&&... vs) {
You can’t perform that action at this time.
0 commit comments