Title
Exposition-only classes proxy and postfix-proxy for common_iterator should be fully constexpr
Status
c++23
Section
[common.iter.access][common.iter.nav]
Submitter
Hewill Kang

Created on 2021-09-18.00:00:00 last changed 13 months ago

Messages

Date: 2021-10-14.09:56:08

Proposed resolution:

This wording is relative to N4892.

  1. Modify [common.iter.access] as indicated:

    decltype(auto) operator->() const
      requires see below;
    

    -3- […]

    -4- […]

    -5- Effects:

    1. (5.1) — […]

    2. (5.2) — […]

    3. (5.3) — Otherwise, equivalent to: return proxy(*get<I>(v_)); where proxy is the exposition-only class:

      class proxy {
        iter_value_t<I> keep_;
        constexpr proxy(iter_reference_t<I>&& x)
          : keep_(std::move(x)) {}
      public:
        constexpr const iter_value_t<I>* operator->() const noexcept {
          return addressof(keep_);
        }
      };
      
  2. Modify [common.iter.nav] as indicated:

    decltype(auto) operator++(int);
    

    -4- […]

    -5- Effects: If I models forward_iterator, equivalent to:

    […]

    Otherwise, if […]

    […]

    Otherwise, equivalent to:

    postfix-proxy p(**this);
    ++*this;
    return p;
    

    where postfix-proxy is the exposition-only class:

    class postfix-proxy {
      iter_value_t<I> keep_;
      constexpr postfix-proxy(iter_reference_t<I>&& x)
        : keep_(std::forward<iter_reference_t<I>>(x)) {}
    public:
      constexpr const iter_value_t<I>& operator*() const noexcept {
        return keep_;
      }
    };
    
Date: 2021-10-14.00:00:00

[ 2021-10-14 Approved at October 2021 virtual plenary. Status changed: Voting → WP. ]

Date: 2021-09-15.00:00:00

[ 2021-09-24; Reflector poll ]

Set status to Tentatively Ready after seven votes in favour during reflector poll.

Date: 2021-09-18.00:00:00

LWG 3574 added constexpr to all member functions and friends of common_iterator to make it fully constexpr, but accidentally omitted the exposition-only classes proxy and postfix-proxy defined for some member functions. We should make these two classes fully constexpr, too.

History
Date User Action Args
2023-11-22 15:47:43adminsetstatus: wp -> c++23
2021-10-14 09:56:08adminsetmessages: + msg12145
2021-10-14 09:56:08adminsetstatus: voting -> wp
2021-09-29 12:57:28adminsetstatus: ready -> voting
2021-09-24 17:55:02adminsetmessages: + msg12075
2021-09-24 17:55:02adminsetstatus: new -> ready
2021-09-19 12:29:34adminsetmessages: + msg12044
2021-09-18 00:00:00admincreate