2883. The standard library should provide string_view parameters instead or in addition for functions defined with char const * or string const & as parameter types.

Section: 24.4 [string.view] Status: LEWG Submitter: Switzerland Opened: 2017-02-03 Last modified: 2017-07-16

Priority: Not Prioritized

View other active issues in [string.view].

View all other issues in [string.view].

View all issues with LEWG status.

Discussion:

Addresses CH 9

The standard library should provide string_view parameters instead or in addition for functions defined with char const * or string const & as parameter types. Most notably in cases where both such overloads exist or where an internal copy is expected anyway.

It might be doubted that the non-null termination of string_view could be an issue with functions that pass the char * down to OS functions, such as fstream_buf::open() etc. and those shouldn't provide it and favour generating a std::string temporary instead in that case. However, std::path demonstrates it is usable to have string_view overloads and there might be many places where it can be handy, or even better.

Proposed change: Provide the overloads for std::regex, the exception classes, std::bitset, std::locale and more.

[Post-Kona 2017]

Most (all?) of these changes were proposed in P0506r1, which was discussed by LEWG in Kona.

[2017-07 Toronto Thurs Issue Prioritization]

Status LEWG - they're already looking at this.

Proposed resolution: