Skip to content

PL247 22.07.3 [views.span] span::c/begin/end return type confusion LWG 3320 #243

@wg21bot

Description

@wg21bot

span<T> provides a const-qualified begin() method and cbegin() method that produces a different result if T is not const-qualifed:

  1. begin() produces mutable iterator over T (as if T*)
  2. cbegin() preduces const iterator over T (as if T const*)
    As consequence for the object s of type span<T>, the call to the std::cbegin(s)/std::ranges::cbegin(s) produces different result than s.cbegin().

Proposed change:
Change span<T> members cbegin()/cend()/crbegin()/crend()/const_iterator to be equivalent to begin()/end()/rbegin()/rend()/iterator respectivelly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions