News for hackers. Stuff that matters.
Re:Sane C++ Libraries by jsheard on Saturday January 27, 2024 @07:08PM (#39161160)
There's also the issue that std::vector<bool> is required by the standard to be specialized as a bitset, which is a footgun in generic code since you can normally take the address of a vector element but not if it's a vector of bool. Having a bitset in the standard library is fine but it should have been a seperate type.

Admittedly that's not a performance issue, but it's annoying.

Re:Sane C++ Libraries by jeffbee on Saturday January 27, 2024 @08:11PM (#39161544)
That's true but I think everyone knows about vector<bool> being quirky. By the way, the standard does not require vector<bool> to be implemented as a bitset. Instead, it relaxes some of the details of vector, in a way that allows the implementation to do it that way. But these choices are implementation details.

Vector<bool> is a little weird if you are just starting with C++, but it does have major performance benefits in its niche, and it came from the 1990s so we can be generous in overlooking its rough edges.

Re:Sane C++ Libraries by HelloNurse on Sunday January 28, 2024 @06:12AM (#39164531)
It came from the 1990s, but it overstayed its welcome. I remember seeing proposals to remove the vector<bool> special case, what is the situation?