C++ Logo

std-proposals

Advanced search

Re: [std-proposals] String Slicing Draft Proposal

From: Rhidian De Wit <rhidiandewit_at_[hidden]>
Date: Thu, 14 Mar 2024 09:59:18 +0100
Hi!

You're completely right of course, overloading wouldn't work in that case.
I had implemented these functions and tested them for myself, but I didn't
implement the *= 1* in the overloaded *slice()* function.
I'll remove the default argument to fix the overloading, and implement a
check where it has to be 1 at the very least.

Thanks a lot!


Op do 14 mrt 2024 om 08:54 schreef Pavel Vazharov <freakpv_at_[hidden]>:

> 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?
>
> Regards,
> Pavel.
>
> On Thu, Mar 14, 2024 at 9:49 AM Rhidian De Wit via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>
>> Hi all,
>>
>> With some helpful suggestions, I'd like to present my draft proposal for
>> the inclusion of several new utility functions to be added to
>> *std::basic_string*.
>>
>> Please reach out if you have any questions, concerns or feedback!
>>
>> Sincerely,
>>
>> --
>> Rhidian De Wit
>> Software Engineer - Barco
>> --
>> Std-Proposals mailing list
>> Std-Proposals_at_[hidden]
>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>>
>

-- 
Rhidian De Wit
Software Engineer - Barco

Received on 2024-03-14 08:59:31