Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P3044 R0 sub-string_view from string #1737

Open
wg21bot opened this issue Jan 17, 2024 · 1 comment
Open

P3044 R0 sub-string_view from string #1737

wg21bot opened this issue Jan 17, 2024 · 1 comment
Labels
B2 - improvement Bucket 2 as described by P0592: bug fixes, performance improvements, integration fixes for/between e C++26 Targeted at C++26 IS Ship vehicle: IS LEWG Library Evolution ranges std::ranges ready-for-library-evolution-meeting-review This paper needs to be discussed at a Library Evolution meeting size - small paper size estimate
Milestone

Comments

@wg21bot
Copy link
Collaborator

wg21bot commented Jan 17, 2024

P3044R0 sub-string_view from string (Michael Florian Hava)

@wg21bot wg21bot added the LEWG Library Evolution label Jan 17, 2024
@wg21bot wg21bot added this to the 2024-telecon milestone Jan 17, 2024
@inbal2l inbal2l added IS Ship vehicle: IS C++26 Targeted at C++26 size - small paper size estimate ranges std::ranges B2 - improvement Bucket 2 as described by P0592: bug fixes, performance improvements, integration fixes for/between e ready-for-library-evolution-meeting-review This paper needs to be discussed at a Library Evolution meeting labels Jan 17, 2024
@inbal2l inbal2l added ready-for-library-evolution-mailing-list-review This paper needs to be discussed on the Library Evolution mailing list scheduled-for-library-evolution This paper has been scheduled for one of the groups: LEWG, LEWG Incubator, or a Mailing List review labels Feb 17, 2024
@ednolan
Copy link

ednolan commented May 7, 2024

A feedback round was started on the mailing list on May 7, 2024.
https://lists.isocpp.org/lib-ext/2024/05/27310.php

Summary:

  • Reviewers discussed the name of the proposed member function.
    • Multiple reviewers preferred the alternative name view().
    • A reviewer pointed out that the existing standard library facilities basic_stringbuf and basic_istringstream have view() member functions.
    • A reviewer expressed support for having the expression st.view() return a view of the entire string. The reviewer floated providing a separate subview member function alongside a zero-argument view if there was not enough support for renaming subview.
    • A reviewer rejoined that the primary use case for the member function as is as a more efficient replacement for substr, and it shouldn't be named to optimize for the rare and incidental case of using it to obtain a view to the entire string (which can already be done by constructing a std::string_view).
  • Reviewers discussed the member function's reference qualification.
    • A reviewer called the facility a footgun without lvalue reference-qualification, because auto x = getstring().subview(...); dangles.
    • A reviewer pointed out that the basic_streambuf and basic_istringstream view member functions are not lvalue-qualified.
    • A reviewer replied that qualifying them may not have been considered when they were standardized.
    • A reviewer pointed out that adding lvalue reference qualification rules out an example like foo(getstring().subview(begin, end)).
    • A reviewer replied that LEWG should adjudicate whether it's acceptable to make users use the workaround of { const std::string& s = getstring(); foo(s.subview(begin, end)); }.
    • A reviewer claimed that the member function should not be lvalue-qualified because doing so conflates value category with lifetime.

The paper is deferred to meeting review.

@ednolan ednolan removed the ready-for-library-evolution-mailing-list-review This paper needs to be discussed on the Library Evolution mailing list label May 7, 2024
@inbal2l inbal2l removed the scheduled-for-library-evolution This paper has been scheduled for one of the groups: LEWG, LEWG Incubator, or a Mailing List review label May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B2 - improvement Bucket 2 as described by P0592: bug fixes, performance improvements, integration fixes for/between e C++26 Targeted at C++26 IS Ship vehicle: IS LEWG Library Evolution ranges std::ranges ready-for-library-evolution-meeting-review This paper needs to be discussed at a Library Evolution meeting size - small paper size estimate
Projects
None yet
Development

No branches or pull requests

3 participants