C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Bool casting operator to check if a container not empty

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Thu, 19 Oct 2023 18:59:39 +0200
Up till C++2011 there was no guarantee of a terminating null-pointer in std::string s. So std::string("") is not empty empty, but it has size 0 ... and is empty() Really weird :-) -----Ursprüngliche Nachricht----- Von:Ville Voutilainen via Std-Proposals <std-proposals_at_[hidden]> Gesendet:Do 19.10.2023 18:54 Betreff:Re: [std-proposals] Bool casting operator to check if a container not empty An:std-proposals_at_[hidden]; CC:Ville Voutilainen <ville.voutilainen_at_[hidden]>; Giuseppe D‘Angelo <giuseppe.dangelo_at_[hidden]>; On Thu, 19 Oct 2023 at 19:46, Giuseppe D'Angelo via Std-Proposals The major reason why this thing was frowned upon in 2009 when I filed an NB comment suggesting such a change is that if ("") is true. I think it's wrong to reject the idea because of that, because that's just a weird case

Received on 2023-10-19 16:59:41