Topic: Extending std::bitset to be a "container


Author: Michael Hava <mfh@live.at>
Date: Tue, 22 Jan 2019 10:59:54 -0800 (PST)
Raw View
------=_Part_2339_1863096535.1548183594981
Content-Type: multipart/alternative;
 boundary="----=_Part_2340_842313894.1548183594982"

------=_Part_2340_842313894.1548183594982
Content-Type: text/plain; charset="UTF-8"

Recently I was using std::bitset quite extensively and I noticed some
glaring holes in it's interface.
Therefore I want to propose the following additions to its interface:

   - at
   - checked version of operator[]
      - a const-only version of this functionality already exists under the
      name "test"
      - front/back
   - mostly needed for compatibility with "container code"
      - max_size
   - return template size-parameter
      - mostly needed for compatibility with "container code"
      - swap
   - mostly needed for compatibility with "container code
      - arguably there is little to no optimization potential as bitset
      should internally be represented by a linear bytes buffer
   - structured binding
   - as bitset is fixed size, it is a perfect candidate for structured
      binding
      - the const version should be fairly trivial, not quite sure about
      the mutable case
      - [c][r]begin/end
   - the biggest extension to bitset which makes it compatible with STL
      algorithms (and ranges?)
      - const_iterator should be fairly trivial
      - iterator could be a bit more tricky, as we would have to deal with
      proxies again... (but as std::vector<bool> also offers mutable iterators,
      it's certainly doable)

Any comments on the feasibility of such a proposal?

Michael

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/9db039ac-b805-40ae-ac8d-130262c9f45a%40isocpp.org.

------=_Part_2340_842313894.1548183594982
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Recently I was using std::bitset quite extensively an=
d I noticed some glaring holes in it&#39;s interface.<br>Therefore I want t=
o propose the following additions to its interface:</div><ul><li>at<br></li=
><ul><li>checked version of operator[]<br></li><li>a const-only version of =
this functionality already exists under the name &quot;test&quot;<br></li><=
/ul><li>front/back<br></li><ul><li>mostly needed for compatibility with &qu=
ot;container code&quot;<br></li></ul><li>max_size<br></li><ul><li>return te=
mplate size-parameter<br></li><li>mostly needed for compatibility with &quo=
t;container code&quot;<br></li></ul><li>swap<br></li><ul><li>mostly needed =
for compatibility with &quot;container code<br></li><li>arguably there is l=
ittle to no optimization potential as bitset should internally be represent=
ed by a linear bytes buffer</li></ul><li>structured binding<br></li><ul><li=
>as bitset is fixed size, it is a perfect candidate for structured binding<=
br></li><li>the const version should be fairly trivial, not quite sure abou=
t the mutable case <br></li></ul><li>[c][r]begin/end<br></li><ul><li>the bi=
ggest extension to bitset which makes it compatible with STL algorithms (an=
d ranges?)<br></li><li>const_iterator should be fairly trivial<br></li><li>=
iterator could be a bit more tricky, as we would have to deal with proxies =
again... (but as std::vector&lt;bool&gt; also offers mutable iterators, it&=
#39;s certainly doable)</li></ul></ul><div>Any comments on the feasibility =
of such a proposal?</div><div><br></div><div>Michael</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/9db039ac-b805-40ae-ac8d-130262c9f45a%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/9db039ac-b805-40ae-ac8d-130262c9f45a=
%40isocpp.org</a>.<br />

------=_Part_2340_842313894.1548183594982--

------=_Part_2339_1863096535.1548183594981--

.