This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [v3 PATCH] Implement LWG 2451
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Ville Voutilainen <ville dot voutilainen at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Wed, 6 Jul 2016 13:51:48 +0100
- Subject: Re: [v3 PATCH] Implement LWG 2451
- Authentication-results: sourceware.org; auth=none
- References: <CAFk2RUYgztYzZd=K545syLL_7TeHPZ6G3Y3xiVr3BxZuSdjFhQ@mail.gmail.com>
On 06/07/16 00:44 +0300, Ville Voutilainen wrote:
Implement LWG 2451, optional<T> should 'forward' T's
implicit conversions.
* include/experimental/optional (__is_optional_impl, __is_optional):
New.
(optional()): Make constexpr and default.
(optional(_Up&&), optional(const optional<_Up>&),
optional(optional<_Up>&& __t): New.
(operator=(_Up&&)): Constrain.
(operator=(const optional<_Up>&), operator=(optional<_Up>&&)): New.
* testsuite/experimental/optional/cons/value.cc:
Add tests for the functionality added by LWG 2451.
* testsuite/experimental/optional/cons/value_neg.cc: New.
As I mentioned on IRC, experimental::optional is C++14-only so you can
use remove_cv_t and enable_if_t to get rid of some of the typename
X::type clutter.
OK for trunk and gcc-6 with or without that change, your choice.