Created on 2016-11-24.00:00:00 last changed 50 months ago
Rationale:
P0433R2.[ 2020-11-09 Resolved for C++20. Status changed: Tentatively Resolved → Resolved. ]
[ 2017-01-30 Ville comments: ]
Seems like the problem is resolved by a simple deduction guide:
template <class T> optional(T) -> optional<T>;
The paper p0433r0 seems to suggest a different guide,
template<class T> optional(T&& t) -> optional<remove_reference_t<T>>;
but I don't think the paper is up to speed with LWG 2756. There's no reason to use such an universal reference in the guide and remove_reference in its target, just guide with T, with the target optional<T>, optional's constructors do the right thing once the type has been deduced.
[ 2017-01-27 Telecon ]
Priority 2
LWG 2756 applies these changes:
constexpr optional(const T&); constexpr optional(T&&);template <class... Args> constexpr explicit optional(in_place_t, Args&&...); template <class U, class... Args> constexpr explicit optional(in_place_t, initializer_list<U>, Args&&...); template <class U = T> EXPLICIT constexpr optional(U&&); template <class U> EXPLICIT optional(const optional<U>&); template <class U> EXPLICIT optional(optional<U>&&);
These break the ability for optional to perform class template argument deduction, as there is now no way to map from optional's argument to the template parameter T.
History | |||
---|---|---|---|
Date | User | Action | Args |
2020-11-09 22:09:58 | admin | set | messages: + msg11597 |
2020-05-31 09:54:47 | admin | set | messages: + msg11312 |
2020-05-31 09:54:47 | admin | set | messages: + msg11311 |
2020-05-31 09:54:47 | admin | set | status: lewg -> resolved |
2017-01-30 15:17:53 | admin | set | messages: + msg8803 |
2017-01-30 15:17:53 | admin | set | messages: + msg8802 |
2017-01-30 15:17:53 | admin | set | status: new -> lewg |
2016-11-24 00:00:00 | admin | create |