<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" 
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:admin="http://webns.net/mvcb/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
	<channel>
<title>My RSS Feed</title><link>https://freshsources.com/index.html</link><description>Hot News&#x21;</description><dc:language>en</dc:language><language>en</language><dc:date>2026-05-25T12:33:30-05:00</dc:date><admin:generatorAgent rdf:resource="http://www.realmacsoftware.com/" />
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
<lastBuildDate>Tue, 26 May 2026 10:47:07 -0500</lastBuildDate><item><title>The std::bitset Story</title><dc:subject>Blog</dc:subject><dc:date>2026-05-25T12:33:30-05:00</dc:date><link>https://freshsources.com/blog/files/the-bitset-story.html#unique-entry-id-0</link><guid isPermaLink="true">https://freshsources.com/blog/files/the-bitset-story.html#unique-entry-id-0</guid><content:encoded><![CDATA[<span style="font-size:14px; color:#000000;"><br /><h2>How a Practical MS‑DOS Problem Contributed to C++</h2><br /><p><b>std::bitset</b> feels like one of those standard library components that must have existed forever &mdash; a compact, efficient, type‑safe abstraction for working with fixed‑size collections of bits. But behind this ordinary feature lies a very human story: one that begins in an MS‑DOS application and winds through the earliest days of C++ standardization.</p><br /><p>This is the story of how <b>std::bitset</b> came to be.</p><br /><h3>A Practical Problem in a Constrained World</h3><br /><p>In the early 1990s I was working as a technical lead in the Information Systems Department of the Church of Jesus Christ of Latter‑day Saints in Salt Lake City. Our Mission Management System ran under MS‑DOS and was written in C. Memory was tight (640K RAM was the limit in those days) and every byte mattered.</p><br /><p>One of my many tasks was to implement drop‑down picklists, and I wanted a compact way to record which entries a user had selected. The solution was simple: associate with each picklist a set of bits stored in an integer and provide an interface that treated that integer as an indexable array of bits.</p><br /><p>It solved the problem cleanly&mdash;and, as it turned out, planted the seed for a future standard library component.</p><br /><h3>From Local Utility to Committee Proposal</h3><br /><p>I had just begun serving on the C++ standards committee (then J16) at the time. At the third committee meeting in Lund, Sweden in June 1991, I volunteered to survey existing third‑party C++ libraries. When I reported back at the next meeting, we began assigning follow‑up work, and I took on the task of exploring bit‑handling classes.</p><br /><p>It was natural to generalize the bit‑array abstraction I had already built. The result was two classes: </span><span style="font-size:14px; color:#000000;font-weight:bold; ">bitset</span><span style="font-size:14px; color:#000000;"> (originally named just </span><span style="font-size:14px; color:#000000;font-weight:bold; ">bits</span><span style="font-size:14px; color:#000000;">) and </span><span style="font-size:14px; color:#000000;font-weight:bold; ">bitstring</span><span style="font-size:14px; color:#000000;">. I documented them in a paper titled &ldquo;</span><span style="font-size:14px; color:#000000;"><a href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/1993/N0220R2.asc" target="_blank">Two Bit Handling Classes for C++</a></span><span style="font-size:14px; color:#000000;">.&rdquo; Committee member Stephen Clamage, with characteristic wit, joked that these were just "</span><span style="font-size:14px; color:#000000;"><a href="https://idiomorigins.org/origin/two-bit" target="_blank">two‑bit classes</a></span><span style="font-size:14px; color:#000000;">.&rdquo;</p><br /><h3>Solidifying Templates</h3><br /><p>This was the dawn of templates in C++. </p><br /><p>Language designer </span><span style="font-size:14px; color:#000000;"><a href="https://www.stroustrup.com" target="_blank">Bjarne Stroustrup</a></span><span style="font-size:14px; color:#000000;"> had, with incredible vision, specified template syntax and behavior, featuring both type and non-type parameters, in The Annotated C++ Reference Manual (</span><span style="font-size:14px; color:#000000;"><a href="https://www.stroustrup.com/arm.html" target="_blank">ARM</a></span><span style="font-size:14px; color:#000000;">), which served as the basis for standardizing the language.  The power of templates was manifest, but as is always the case, some details had to be worked out to make them standard-ready, even in those early days before template metaprogramming was discovered.</p><br /><p>When I presented my initial bitset design, iostreams designer </span><span style="font-size:14px; color:#000000;"><a href="https://patents.justia.com/inventor/jerry-schwarz" target="_blank">Jerry Schwarz</a></span><span style="font-size:14px; color:#000000;"> suggested that the number of bits could be a template parameter. That opened my mind to what templates in C++ were capable of. (This was when we were still using macros to implement templates, and few people knew what was coming. The Standard Template Library/STL had yet to migrate from Alex Stepanov&rsquo;s Lisp implementation.) My proposal gave the committee a concrete use case for fleshing out the semantics of non‑type template parameters. To my knowledge, it was the first class in standard C++ to use a non-type template parameter.</p><br /><h3>Acceptance and Standardization</h3><br /><p>I completed the proposal and reference implementation in 1993, and the committee accepted it in 1994, about the same time as STL was revolutionizing what C++ would become. When C++98 was published, std::bitset appeared as a fully integrated part of the standard library. Bruce Eckel&rsquo;s foreword in my first book, </span><span style="font-size:14px; color:#000000;"><a href="https://www.amazon.com/Code-Capsules-Guide-Practitioners/dp/0135917859" target="_blank">C & C++ Code Capsules</a></span><span style="font-size:14px; color:#000000;"> (Prentice-Hall, 1998), comments on my authorship of std::bitset, providing a contemporaneous record of its origins and its role in the early standardization process.</p><br /><h3>The Parallel Lineage: bitstring, vector&lt;bool&gt;, and dynamic_bitset</h3><br /><p>The second class from my original paper, </span><span style="font-size:14px; color:#000000;font-weight:bold; ">bitstring</span><span style="font-size:14px; color:#000000;">, followed a different path. It evolved into the well‑known (and controversial) specialization </span><span style="font-size:14px; color:#000000;font-weight:bold; ">vector&lt;bool&gt;</span><span style="font-size:14px; color:#000000;"> (not my idea!). Years later Jeremy Siek packaged my original reference implementation for inclusion into the famous </span><span style="font-size:14px; color:#000000;"><a href="https://www.boost.org" target="_blank">Boost</a></span><span style="font-size:14px; color:#000000;"> library as </span><span style="font-size:14px; color:#000000;font-weight:bold; ">dynamic_bitset</span><span style="font-size:14px; color:#000000;">, which still carries structural traces of its origins. </span><span style="font-size:14px; color:#000000;"><a href="https://www.boost.org/doc/libs/latest/libs/dynamic_bitset/doc/html/dynamic_bitset/reference/boost/dynamic_bitset.html" target="_blank">Boost::dynamic_bitset</a></span><span style="font-size:14px; color:#000000;"> has been used in commercial software shipped on millions of machines.</p><br /><h3>A Small Abstraction with a Long Shadow</h3><br /><p></span><span style="font-size:14px; color:#000000;font-weight:bold; ">std::bitset</span><span style="font-size:14px; color:#000000;"> is a reminder that the C++ standard library was not handed down from a monolithic design team. It was built by individuals solving real problems, sharing their ideas, and shaping the language through practical insight and working code. In my case it was a picklist, a few bits, and just showing up willing to participate.</p><br /><p>Many opportunities came my way because of my years-long association with the C++ Standards Committee, most notably with </span><span style="font-size:14px; color:#000000;"><a href="https://en.wikipedia.org/wiki/P._J._Plauger" target="_blank">P. J. Plauger</a></span><span style="font-size:14px; color:#000000;">, who invited me to be a columnist for the C/C++ Users Journal, and with </span><span style="font-size:14px; color:#000000;"><a href="https://en.wikipedia.org/wiki/Bruce_Eckel" target="_blank">Bruce Eckel</a></span><span style="font-size:14px; color:#000000;">, who invited me to be a presenter at Software Development Conference and to later co-author </span><span style="font-size:14px; color:#000000;"><a href="https://www.amazon.com/Thinking-C-2-Practical-Programming/dp/0130353132/ref=sr_1_2?adgrpid=1331509145528401&dib=eyJ2IjoiMSJ9.IOs79VUBS62tao49lSj8GQ5CHSFxdVNFXwbcEPty_O0TuTJ2e3BIih94G3D775DE-9O17b3wJD_uFBzGfll72ZhR-tiNfs-1fa9uWXX12_pv-QhHJdRcfZnClY4jPva8d4XwpbvBtpWHR64GhFOVTDfex0A49oNOGI2yOINutNwaAHGgFvJXxyPe2bq48ucUG5GLN38AGlRIDgjofF_5PL-1CBhQVVrocyt-BGEOtI4.ve_gFzRPR6ATZiCBvlcTV5AiJXr4rM4ZmQ-jZzluA-k&dib_tag=se&hvadid=83219560634629&hvbmt=bp&hvdev=c&hvlocphy=102979&hvnetw=o&hvqmt=p&hvtargid=kwd-83219669039102%3Aloc-190&hydadcr=22562_13494426&keywords=thinking+in+c+volume+2&mcid=d41b2228b0e63a028d6ff74dac2c2fde&msclkid=ffd0faaad3bb1be6572290be4fc1cde0&qid=1779735678&sr=8-2" target="_blank">Thinking in C++, Volume 2</a></span><span style="font-size:14px; color:#000000;"> with him. Bjarne Stroustrup himself graciously acknowledged my modest editorial contributions in the second and third editions of his </span><span style="font-size:14px; color:#000000;"><a href="https://www.amazon.com/Tour-C-Bjarne-Stroustrup/dp/0136816487/ref=sr_1_1?adgrpid=1335907203006293&dib=eyJ2IjoiMSJ9.6IUZFVJ2PlDYwVWvY0zCQ_9LtCT6Ay-eFjMbuEA2KR4hzWDaLln8YAN3YGVZ8NCBwWUSYYeiQ9KmVOZZkcbRsvCnywQ0cM3zBWKJ4IjAzY4K1S7jEPsNsnamdaZeBF4j4KQZObqMd_V59OPOVf0PossMGJnNMw0GN0xCkNfyixs4jVQ9cqJjc4NSu7Oiov6zdRbBPawq_dQuYwkuWbIxq-xNnnj46iQqyAEWXKyixpA.Eac8qSYpb_mVYwQmBTeX1b3etA7PCPN4PGC-JV7FaHM&dib_tag=se&hvadid=83494438603297&hvbmt=bp&hvdev=c&hvlocphy=95075&hvnetw=o&hvqmt=p&hvtargid=kwd-83494566412018%3Aloc-190&hydadcr=22532_13494449&keywords=a+tour+of+c%2B%2B&mcid=59992bc6719232cdb64446d010a7ff26&msclkid=c2f7bf809eb71a8f71dad5940255a700&qid=1779735787&sr=8-1" target="_blank">Tour of C++</a></span><span style="font-size:14px; color:#000000;">.</p><br /><hr><br /><p>I often felt quite ordinary in the presence of the great ones who fashioned such an amazing programming language (Bjarne Stroustrup, Andy Koenig, Jerry Schwarz, Tom Plum, Matt Austern, John Spicer, Pete Becker, and then-chairs Dmitri Lenkov and Stephen Clamage, to name just a few&mdash;it&rsquo;s a long, long list&hellip;), but I&rsquo;ll always be grateful I was in the room where it happened.</p><br /></span>]]></content:encoded></item></channel>
</rss>