[v3 PATCH] Implement P0307R2, Making Optional Greater Equal Again.

Jonathan Wakely jwakely@redhat.com
Wed Jul 13 10:43:00 GMT 2016


On 13/07/16 13:05 +0300, Ville Voutilainen wrote:
>Ha, that was indeed in just one place.

See below.

>I made the above changes and also made converting assignment operators
>SFINAE. That SFINAE
>seems consistent with how constructors and relops work. And yes, there
>are still some members like
>emplace that static_assert rather than SFINAE, but I think that's ok for now.
>    operators. Also test that assignment sfinaes.

OK.

>diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional
>index e9a86a4..45929c7 100644
>--- a/libstdc++-v3/include/std/optional
>+++ b/libstdc++-v3/include/std/optional
>@@ -132,7 +132,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>     *
>     * Practically speaking this detects the presence of such an operator when
>     * called on a const-qualified lvalue (i.e.
>-    * declval<_Tp * const&>().operator&()).
>+    * declval<const _Tp *&>().operator&()).
>     */
>   template<typename _Tp>
>     struct _Has_addressof

That comment was wrong anyway, it says _Tp* const& when it should have
been _Tp const&.

declval<_Tp * const&>().operator&() doesn't make any sense. Not sure
why I've never spotted that until now.

Please change it to const _Tp& and change "i.e." to "e.g." (because
since my change last year it detects both members and non-members).

OK for trunk with that tweak, thanks.

I'll make the same change to the comment in <experimental/optional>.



More information about the Libstdc++ mailing list