This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Open status.

2990. optional::value_type is not always a value type

Section: 22.5.3 [optional.optional] Status: Open Submitter: Casey Carter Opened: 2017-06-27 Last modified: 2018-01-28

Priority: 3

View all other issues in [optional.optional].

View all issues with Open status.


optional<T>::value_type is T, which can be a cv-qualified object type. This is inconsistent with the uses of the name value_type elsewhere in the standard. We should either require optional<T>::value_type to be remove_cv_t<T> — a true value type — or rename the type alias to element_type.

[2017-07 Toronto Tuesday PM issue prioritization]

Priority 3; may also affect array

[2018-1-26 issues processing telecon]

Status to 'Open'

Proposed resolution:

This wording is relative to N4659.

  1. Edit 22.5.3 [optional.optional], class template optional synopsis, as indicated:

    template <class T>
      class optional {
        using value_type = remove_cv_t<T>;