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.

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

Section: 99 [iterator.container] Status: WP Submitter: Tim Song Opened: 2017-08-11 Last modified: 2018-03-18

Priority: 0

View all issues with WP 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 99 [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>.