File tree 2 files changed +12
-1
lines changed
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ public:
51
51
52
52
template <typename ... U>
53
53
void return_value (U&&... value) {
54
- _promise.set_value (std::forward<U>(value)...);
54
+ _promise.set_value (non_explicit_tag{}, std::forward<U>(value)...);
55
55
}
56
56
57
57
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 {
282
282
template <typename T>
283
283
using maybe_wrap_ref = std::conditional_t <std::is_reference_v<T>, std::reference_wrapper<std::remove_reference_t <T>>, T>;
284
284
285
+ struct non_explicit_tag {};
286
+
287
+
285
288
// / \brief Wrapper for keeping uninitialized values of non default constructible types.
286
289
// /
287
290
// / 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> {
302
305
maybe_wrap_ref<T> value;
303
306
} _v;
304
307
308
+ template <typename U>
309
+ static T make_implicitly (U&& v) {
310
+ return std::forward<U>(v);
311
+ }
305
312
public:
306
313
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
+ }
307
318
template <typename ... U>
308
319
std::enable_if_t <!std::is_same_v<std::tuple<std::remove_cv_t <U>...>, std::tuple<tuple_type>>, void >
309
320
uninitialized_set (U&&... vs) {
You can’t perform that action at this time.
0 commit comments