C++ Logo

std-proposals

Advanced search

Re: [std-proposals] String Slicing Draft Proposal

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Thu, 14 Mar 2024 08:11:14 +0000
On Thu, 14 Mar 2024, 07:55 Pavel Vazharov via Std-Proposals, <
std-proposals_at_[hidden]> wrote:

> Hi there,
>
> How are these two supposed to be distinguished by the compiler if the 3rd
> parameter is defaulted.
> /* 1. */ basic_string_view basic_string::slice(size_t start, size_t
> end);
> /* 2. */ basic_string basic_string::slice(size_t start, size_t
> end, size_t step = 1);
>
> I mean, I don't see how the function overloading will work in this case.
> const auto str = initial_str.slice(3, 5); // which of the above two is
> called?
>

Which suggests this code has never been implemented and tested.

Received on 2024-03-14 08:12:33