r/cpp • u/Weary-Inspector-4297 • May 26 '26
How an MS-DOS picklist problem in 1991 became std::bitset -- by the author who proposed it
I served on the original ISO C++ Standards Committee (J16) and proposed std::bitset. I recently wrote up the story of how it came to be -- starting from a memory-constrained MS-DOS application, through the early days of templates, and into C++98.
I also touch on the parallel story of bitstring, which became vector<bool> and eventually boost::dynamic_bitset.
https://freshsources.com/blog/files/0efc66caabe2cb443a6acae6aca0f707-0.html
95
Upvotes
4
u/daveedvdv EDG front end dev, WG21 DG Jun 01 '26
Thanks for writing that up!
17
u/ABlockInTheChain May 26 '26
What a terrible URL.
Some day people are going to find this Reddit post and click on the link and it won't go to the correct blog entry.
45
u/HildartheDorf May 26 '26
Ahhh, std::vector<bool> my behated.
(Yes, a dynamic bitset/bitstring is a useful type, but it shouldn't be an API-differing template specialisation)
2
u/AltitudeZero_ May 26 '26
What was your use case for the
bitstringand how was the class looked like? Is this also the motivation of the constructor of thestd::bitsetthat takes a string?19
u/MFHava WG21|🇦🇹 NB|P3049|P3625|P3729|P3786|P3813|P4216 May 26 '26
Interesting read! If only they didn't decide to transform
bitstringintovector<bool>...3
u/woppo May 26 '26
This was so inyteresting but I left feeling very short changed. This was more of a social history: I wanted to see the design decisions you made, the trade-offs you encountered, the dealing with a nascent standards committee.
It was a little underwhelming but thank you anyway.
3
u/mvolling May 26 '26
Cool read! Thanks for sharing.
1
u/Sopel97 May 26 '26
I don't think I've actually ever used std::bitset, because every time I needed it sizeof()==8 was not viable.