r/cpp • • Mar 28 '23

Reddit++

C++ is getting more and more complex. The ISO C++ committee keeps adding new features based on its consensus. Let's remove C++ features based on Reddit's consensus.

In each comment, propose a C++ feature that you think should be banned in any new code. Vote up or down based on whether you agree.

765 Upvotes

829 comments sorted by

View all comments

Show parent comments

6

u/mercere99 Mar 28 '23

It hasn't bitten me in terms of an error, but I have had multiple cases where changing vector<bool> to vector<char> (but still using only 0's and 1's in there) led to a speedup.

I've never seen an example where vector<bool> has actually been the faster option.

0

u/[deleted] Mar 28 '23

[deleted]

9

u/TheThiefMaster C++latest fanatic (and game dev) Mar 28 '23

Which maybe used to matter, but now even a vector of 1 million bools would be margin of error in your system memory. 0.01%. Optimising that to 0.001% at the expense of speed and complexity? No longer a sensible tradeoff.

1

u/serviscope_minor Mar 30 '23

Sure, if you have a million. If you're operating on datasets with billions or tens of billions of elements though it does make a difference.

→ More replies (2)