Date
2020-02-13.05:28:08
Message id
10777

Content

Proposed resolution:

This wording is relative to N4835.

  1. Modify [range.view] as indicated:

    template<class T>
      inline constexpr bool enable_view = see belowderived_from<T, view_base>;
    

    -4- Remarks: For a type T, the default value of enable_view<T> is:

    1. (4.1) — If derived_from<T, view_base> is true, true.

    2. (4.2) — Otherwise, if T is a specialization of class template initializer_list ([support.initlist]), set ([set]), multiset ([multiset]), unordered_set ([unord.set]), unordered_multiset ([unord.multiset]), or match_results ([re.results]), false.

    3. (4.3) — Otherwise, if both T and const T model range and range_reference_t<T> is not the same type as range_reference_t<const T>, false. [Note: Deep const-ness implies element ownership, whereas shallow const-ness implies reference semantics. — end note]

    4. (4.4) — Otherwise, true.

  2. Modify [string.view.synop], header <string_view> synopsis, as indicated:

    namespace std {
      // [string.view.template], class template basic_string_view
      template<class charT, class traits = char_traits<charT>>
      class basic_string_view;
      
      template<class charT, class traits>
        inline constexpr bool ranges::enable_view<basic_string_view<charT, traits>> = true;
        
      […]
    }
    
  3. Modify [span.syn], header <span> synopsis, as indicated:

    namespace std {
      // constants
      inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max();
      
      // [views.span], class template span
      template<class ElementType, size_t Extent = dynamic_extent>
      class span;
        
      template<class ElementType, size_t Extent>
        inline constexpr bool ranges::enable_view<span<ElementType, Extent>> = Extent == 0 || 
          Extent == dynamic_extent;
        
      […]
    }
    
  4. Modify [range.split.outer.value], class split_view::outer_iterator::value_type synopsis, as indicated:

    [Drafting note: The following applies the proposed wording for LWG 3276]

    namespace std::ranges {
      template<class V, class Pattern>
      template<bool Const>
      struct split_view<V, Pattern>::outer_iterator<Const>::value_type 
        : view_interface<value_type> {
      private:
        outer_iterator i_ = outer_iterator(); // exposition only
      public:
        value_type() = default;
        constexpr explicit value_type(outer_iterator i);
    
        constexpr inner_iterator<Const> begin() const;
        constexpr default_sentinel_t end() const;
      };
    }