Date: Sat, 21 Oct 2023 22:29:15 -0400
On Thu, Oct 19, 2023 at 1:26 PM Federico Kircheis via Std-Proposals <
std-proposals_at_[hidden]> wrote:
>
>
> Also I might not sure if the feature is worth it.
> Unless one wants to get the first element (or an element in a specific
> position), working with empty and non-empty containers normally does not
> require special handling.
>
Yep!
Sadly I often see code like:
if (v.empty()) // unnecessary check for empty
return 0;
int answer = 0;
for (auto e : v)
answer += ....
return answer;
std-proposals_at_[hidden]> wrote:
>
>
> Also I might not sure if the feature is worth it.
> Unless one wants to get the first element (or an element in a specific
> position), working with empty and non-empty containers normally does not
> require special handling.
>
Yep!
Sadly I often see code like:
if (v.empty()) // unnecessary check for empty
return 0;
int answer = 0;
for (auto e : v)
answer += ....
return answer;
-- Be seeing you, Tony
Received on 2023-10-22 02:29:29