C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Iterators for basic_string and basic_string_view find functions

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Fri, 1 Sep 2023 09:36:38 -0400
On Fri, Sep 1, 2023 at 8:18 AM 萧 叶轩 via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> Abstract
>
> This paper proposes to add iterator-based versions of the find family of functions for basic_string and basic_string_view, and deprecate the index-based versions. This is to align with the iterator-based interface of the C++ standard library. The current use of indices and npos is inconsistent with the C++ style and causes confusion and inefficiency.

Why do they need iterator-based member functions for finding when we
have iterator-based algorithms that can do the same job? Is
`x.find(...)` really so much better than `find(x, ...)`? And if it is
so much better, why shouldn't these be on all containers and views?

Received on 2023-09-01 13:36:50