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

3364. Initialize data members of ranges and their iterators

Section: 24.7.7.2 [range.take.while.view], 24.7.8.2 [range.drop.view], 24.7.9.2 [range.drop.while.view], 24.7.15.3 [range.elements.iterator] Status: WP Submitter: Johel Ernesto Guerrero Peña Opened: 2020-01-07 Last modified: 2020-09-06

Priority: 0

View all other issues in [range.take.while.view].

View all issues with WP status.

Discussion:

Before P1035 was accepted, no data member in [ranges] whose type could potentially be an aggregate or fundamental type was left without initializer. P1035 left some such data members without initializer, so it is possible to have them have indeterminate values. We propose restoring consistency.

[2020-01-14 Status set to Tentatively Ready after five positive votes on the reflector.]

Proposed resolution:

This wording is relative to N4842.

  1. Modify 24.7.7.2 [range.take.while.view] as follows:

    class take_while_view : public view_interface<take_while_view<V, Pred>> {
      template<bool> class sentinel;                      // exposition only
    
      V base_ = V();                                      // exposition only
      semiregular-box<Pred> pred_;                        // exposition only
    
    public:
    
  2. Modify 24.7.8.2 [range.drop.view] as follows:

    private:
      V base_ = V();                                     // exposition only
      range_difference_t<V> count_ = 0;                  // exposition only
    };
    
  3. Modify 24.7.9.2 [range.drop.while.view] as follows:

    private:
      V base_ = V();                                     // exposition only
      semiregular-box<Pred> pred_;                       // exposition only
    };
    
  4. Modify 24.7.15.3 [range.elements.iterator] as follows:

    class elements_view<V, N>::iterator {                // exposition only
      using base-t = conditional_t<Const, const V, V>;
      friend iterator<!Const>;
    
      iterator_t<base-t> current_ = iterator_t<base-t>();
    public: