3009. Including <string_view> doesn't provide std::size/empty/data

Section: 25.7 [iterator.range] Status: C++20 Submitter: Tim Song Opened: 2017-08-11 Last modified: 2021-06-06 18:38:24 UTC

Priority: 0

View other active issues in [iterator.range].

View all other issues in [iterator.range].

View all issues with C++20 status.


basic_string_view has size(), empty(), and data() members, but including <string_view> isn't guaranteed to give you access to the corresponding free function templates. This seems surprising.

[ 2017-11-01 Moved to Tentatively Ready after 7 positive votes for P0 on c++std-lib. ]

[2018-3-17 Adopted in Jacksonville]

Proposed resolution:

This resolution is relative to N4687.

  1. Edit [iterator.container] as indicated:

    -1- In addition to being available via inclusion of the <iterator> header, the function templates in 27.8 are available when any of the following headers are included: <array>, <deque>, <forward_list>, <list>, <map>, <regex>, <set>, <string>, <string_view>, <unordered_map>, <unordered_set>, and <vector>.