constexpr optional<T>::operator->
Section: 22.5.3.7 [optional.observe] Status: C++17 Submitter: Agustín K-ballo Bergé Opened: 2016-07-02 Last modified: 2017-07-30
Priority: 0
View other active issues in [optional.observe].
View all other issues in [optional.observe].
View all issues with C++17 status.
Discussion:
optional<T>::operator->
s are constrained to be constexpr
functions
only when T
is not a type with an overloaded unary operator&
. This
constrain comes from the need to use addressof
(or a similar
mechanism), and the inability to do so in a constant expression in
C++14. Given that addressof
is now constexpr
, this constrain is no
longer needed.
[2016-07 Chicago]
Monday: P0 - tentatively ready
Proposed resolution:
This wording is relative to N4594.
Modify [optional.object.observe] as indicated:
constexpr T const* operator->() const; constexpr T* operator->();-1- Requires:
-2- Returns:*this
contains a value.val
. -3- Throws: Nothing. -4- Remarks:UnlessThese functions shall beT
is a user-defined type with overloaded unaryoperator&
, tconstexpr
functions.