Topic: compressed std::bitset<N>


Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Thu, 16 Feb 2017 08:04:50 +0100
Raw View
This is a multi-part message in MIME format.
--------------E501AC91D396CE08C842A594
Content-Type: text/plain; charset=UTF-8; format=flowed

Hi,

I wanted to use bitset<8>,bitset<16>,bitset<32> to represent the mask of
8,16 and 32 bits respectively but the sizeof them is 64 bits on the
systems I've tested.

Wondering if others have suffered already of this situation.

How do you fill about adding a constraint on the implementation, so that
the sizeof shall be respectively 8, 16, 32 bits.

If this is not backward compatible, would it be worth to define a
different type?


Vicente

--
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/32cfea0a-7df8-47cf-47fd-549985f12295%40wanadoo.fr.

--------------E501AC91D396CE08C842A594
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html>
  <head>

    <meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf-8=
">
  </head>
  <body bgcolor=3D"#FFFFFF" text=3D"#000000">
    <p><font size=3D"+1">Hi,</font></p>
    <p><font size=3D"+1">I wanted to use bitset&lt;8&gt;,</font><font
        size=3D"+1"> bitset&lt;16&gt;,</font><font size=3D"+1">
        bitset&lt;32&gt; to represent the mask of 8,16 and 32 bits
        respectively but the sizeof them is 64 bits on the=C2=A0 systems I'=
ve
        tested.</font></p>
    <p><font size=3D"+1">Wondering if others have suffered already of this
        situation. <br>
      </font></p>
    <p><font size=3D"+1">How do you fill about adding a constraint on the
        implementation, so that the sizeof shall be respectively 8, 16,
        32 bits.</font></p>
    <p><font size=3D"+1">If this is not backward compatible, would it be
        worth to define a different type?<br>
      </font></p>
    <p><font size=3D"+1"><br>
      </font></p>
    <p><font size=3D"+1">Vicente<br>
      </font></p>
  </body>
</html>

<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/32cfea0a-7df8-47cf-47fd-549985f12295%=
40wanadoo.fr?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/32cfea0a-7df8-47cf-47fd-549985f12295=
%40wanadoo.fr</a>.<br />

--------------E501AC91D396CE08C842A594--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Wed, 15 Feb 2017 23:29:35 -0800 (PST)
Raw View
------=_Part_11153_1965232507.1487230175364
Content-Type: multipart/alternative;
 boundary="----=_Part_11154_1741110816.1487230175364"

------=_Part_11154_1741110816.1487230175364
Content-Type: text/plain; charset=UTF-8



On Thursday, February 16, 2017 at 2:04:53 AM UTC-5, Vicente J. Botet
Escriba wrote:
>
> Hi,
>
> I wanted to use bitset<8>, bitset<16>, bitset<32> to represent the mask
> of 8,16 and 32 bits respectively but the sizeof them is 64 bits on the
> systems I've tested.
>
> Wondering if others have suffered already of this situation.
>
> How do you fill about adding a constraint on the implementation, so that
> the sizeof shall be respectively 8, 16, 32 bits.
>

I feel the same way I would feel about adding constraints on
implementations to be required to implement `std::uint32_t` et. al. That
is, "not gonna happen".

The best you would reasonably get is requiring that a `bitset<N>` will have
a size no bigger than a `uint_leastN_t`, if `N` is <= 64.

I don't see anything in `bitset`'s API that would make this non-workable.
That doesn't mean there isn't, obviously.

--
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/08db6ce8-ca1c-4d75-a49a-d33e2fb8518b%40isocpp.org.

------=_Part_11154_1741110816.1487230175364
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Thursday, February 16, 2017 at 2:04:53 AM UTC-5=
, Vicente J. Botet Escriba wrote:<blockquote class=3D"gmail_quote" style=3D=
"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex=
;">
 =20

   =20
 =20
  <div bgcolor=3D"#FFFFFF" text=3D"#000000">
    <p><font size=3D"+1">Hi,</font></p>
    <p><font size=3D"+1">I wanted to use bitset&lt;8&gt;,</font><font size=
=3D"+1"> bitset&lt;16&gt;,</font><font size=3D"+1">
        bitset&lt;32&gt; to represent the mask of 8,16 and 32 bits
        respectively but the sizeof them is 64 bits on the=C2=A0 systems I&=
#39;ve
        tested.</font></p>
    <p><font size=3D"+1">Wondering if others have suffered already of this
        situation. <br>
      </font></p>
    <p><font size=3D"+1">How do you fill about adding a constraint on the
        implementation, so that the sizeof shall be respectively 8, 16,
        32 bits.</font></p></div></blockquote><div><br>I feel the same way =
I would feel about adding constraints on implementations to be required to =
implement `std::uint32_t` et. al. That is, &quot;not gonna happen&quot;.<br=
><br>The best you would reasonably get is requiring that a `bitset&lt;N&gt;=
` will have a size no bigger than a `uint_leastN_t`, if `N` is &lt;=3D 64.<=
br><br>I don&#39;t see anything in `bitset`&#39;s API that would make this =
non-workable. That doesn&#39;t mean there isn&#39;t, obviously.<br></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/08db6ce8-ca1c-4d75-a49a-d33e2fb8518b%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/08db6ce8-ca1c-4d75-a49a-d33e2fb8518b=
%40isocpp.org</a>.<br />

------=_Part_11154_1741110816.1487230175364--

------=_Part_11153_1965232507.1487230175364--

.


Author: Marc <marc.glisse@gmail.com>
Date: Thu, 16 Feb 2017 02:00:13 -0800 (PST)
Raw View
------=_Part_2682_1587737247.1487239213651
Content-Type: multipart/alternative;
 boundary="----=_Part_2683_1347528297.1487239213651"

------=_Part_2683_1347528297.1487239213651
Content-Type: text/plain; charset=UTF-8

On Thursday, February 16, 2017 at 8:04:53 AM UTC+1, Vicente J. Botet
Escriba wrote:
>
> Hi,
>
> I wanted to use bitset<8>, bitset<16>, bitset<32> to represent the mask
> of 8,16 and 32 bits respectively but the sizeof them is 64 bits on the
> systems I've tested.
>
> Wondering if others have suffered already of this situation.
>
> How do you fill about adding a constraint on the implementation, so that
> the sizeof shall be respectively 8, 16, 32 bits.
>
> If this is not backward compatible, would it be worth to define a
> different type?
>

That's really QoI. Trying to use the standard to force implementations to
improve on this point seems wrong to me.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63218
(didn't check for other implementations)

--
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/4fda10c9-d748-4874-bc14-5ee952956c99%40isocpp.org.

------=_Part_2683_1347528297.1487239213651
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Thursday, February 16, 2017 at 8:04:53 AM UTC+1, Vicent=
e J. Botet Escriba wrote:<blockquote class=3D"gmail_quote" style=3D"margin:=
 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
 =20

   =20
 =20
  <div bgcolor=3D"#FFFFFF" text=3D"#000000">
    <p><font size=3D"+1">Hi,</font></p>
    <p><font size=3D"+1">I wanted to use bitset&lt;8&gt;,</font><font size=
=3D"+1"> bitset&lt;16&gt;,</font><font size=3D"+1">
        bitset&lt;32&gt; to represent the mask of 8,16 and 32 bits
        respectively but the sizeof them is 64 bits on the=C2=A0 systems I&=
#39;ve
        tested.</font></p>
    <p><font size=3D"+1">Wondering if others have suffered already of this
        situation. <br>
      </font></p>
    <p><font size=3D"+1">How do you fill about adding a constraint on the
        implementation, so that the sizeof shall be respectively 8, 16,
        32 bits.</font></p>
    <p><font size=3D"+1">If this is not backward compatible, would it be
        worth to define a different type?<br></font></p></div></blockquote>=
<div><br>That&#39;s really QoI. Trying to use the standard to force impleme=
ntations to improve on this point seems wrong to me.<br>https://gcc.gnu.org=
/bugzilla/show_bug.cgi?id=3D63218<br>(didn&#39;t check for other implementa=
tions)<br></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/4fda10c9-d748-4874-bc14-5ee952956c99%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/4fda10c9-d748-4874-bc14-5ee952956c99=
%40isocpp.org</a>.<br />

------=_Part_2683_1347528297.1487239213651--

------=_Part_2682_1587737247.1487239213651--

.


Author: 3dw4rd@verizon.net
Date: Mon, 20 Feb 2017 08:31:19 -0800 (PST)
Raw View
------=_Part_1072_251354371.1487608279796
Content-Type: multipart/alternative;
 boundary="----=_Part_1073_1945960660.1487608279796"

------=_Part_1073_1945960660.1487608279796
Content-Type: text/plain; charset=UTF-8



On Thursday, February 16, 2017 at 2:04:53 AM UTC-5, Vicente J. Botet
Escriba wrote:
>
> Hi,
>
> I wanted to use bitset<8>, bitset<16>, bitset<32> to represent the mask
> of 8,16 and 32
>
> Vicente
>

This seems like the kind of thing SG14 might be interested in.


--
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/4eaf3ddb-66af-4892-bfde-d039c92e0bed%40isocpp.org.

------=_Part_1073_1945960660.1487608279796
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Thursday, February 16, 2017 at 2:04:53 AM UTC-5=
, Vicente J. Botet Escriba wrote:<blockquote class=3D"gmail_quote" style=3D=
"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex=
;">
 =20

   =20
 =20
  <div bgcolor=3D"#FFFFFF" text=3D"#000000">
    <p><font size=3D"+1">Hi,</font></p>
    <p><font size=3D"+1">I wanted to use bitset&lt;8&gt;,</font><font size=
=3D"+1"> bitset&lt;16&gt;,</font><font size=3D"+1">
        bitset&lt;32&gt; to represent the mask of 8,16 and 32 <br></font></=
p><p><font size=3D"+1">Vicente<br></font></p></div></blockquote><div><br>Th=
is seems like the kind of thing SG14 might be interested in.<br>=C2=A0<br><=
/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/4eaf3ddb-66af-4892-bfde-d039c92e0bed%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/4eaf3ddb-66af-4892-bfde-d039c92e0bed=
%40isocpp.org</a>.<br />

------=_Part_1073_1945960660.1487608279796--

------=_Part_1072_251354371.1487608279796--

.


Author: ricky.65@hotmail.com
Date: Tue, 21 Feb 2017 12:40:00 -0800 (PST)
Raw View
------=_Part_1587_1044681994.1487709600699
Content-Type: multipart/alternative;
 boundary="----=_Part_1588_279372894.1487709600700"

------=_Part_1588_279372894.1487709600700
Content-Type: text/plain; charset=UTF-8

Hi Vicente,

I think the Bitset2 <https://github.com/ClaasBontus/bitset2>library by
Claas Bontus provides what you are looking for. It's like std::bitset but
with enhanced functionality. It let's you set the underlying integral type
of the bitset. In fact, it defaults to uint8_t, uint16_t, or uint32_t if N bits
fit into those integers. I would like this functionality added to
std::bitset but, as you said, it would probably be a breaking change.

Riccardo

On Thursday, February 16, 2017 at 7:04:53 AM UTC, Vicente J. Botet Escriba
wrote:
>
> Hi,
>
> I wanted to use bitset<8>, bitset<16>, bitset<32> to represent the mask
> of 8,16 and 32 bits respectively but the sizeof them is 64 bits on the
> systems I've tested.
>
> Wondering if others have suffered already of this situation.
>
> How do you fill about adding a constraint on the implementation, so that
> the sizeof shall be respectively 8, 16, 32 bits.
>
> If this is not backward compatible, would it be worth to define a
> different type?
>
>
> Vicente
>

--
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/06e829ca-417b-470c-95ca-c661e8752f79%40isocpp.org.

------=_Part_1588_279372894.1487709600700
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi Vicente,<div><br></div><div><font size=3D"2" face=3D"ar=
ial, sans-serif">I think the <a href=3D"https://github.com/ClaasBontus/bits=
et2">Bitset2 </a>library by Claas Bontus provides what you are looking for.=
 It&#39;s like std::bitset but with enhanced functionality. It let&#39;s yo=
u set the underlying integral type of the bitset. In fact, it=C2=A0<span st=
yle=3D"color: rgb(51, 51, 51);">defaults to uint8_t, uint16_t, or uint32_t=
=C2=A0</span><span style=3D"color: rgb(51, 51, 51);">if N</span><span style=
=3D"color: rgb(51, 51, 51);">=C2=A0bits fit into those integers.</span>=C2=
=A0I would like this functionality added to std::bitset but, as you said, i=
t would probably be a breaking change.</font></div><div><br></div><div>Ricc=
ardo<br><br>On Thursday, February 16, 2017 at 7:04:53 AM UTC, Vicente J. Bo=
tet Escriba wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;marg=
in-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
 =20

   =20
 =20
  <div bgcolor=3D"#FFFFFF" text=3D"#000000">
    <p><font size=3D"+1">Hi,</font></p>
    <p><font size=3D"+1">I wanted to use bitset&lt;8&gt;,</font><font size=
=3D"+1"> bitset&lt;16&gt;,</font><font size=3D"+1">
        bitset&lt;32&gt; to represent the mask of 8,16 and 32 bits
        respectively but the sizeof them is 64 bits on the=C2=A0 systems I&=
#39;ve
        tested.</font></p>
    <p><font size=3D"+1">Wondering if others have suffered already of this
        situation. <br>
      </font></p>
    <p><font size=3D"+1">How do you fill about adding a constraint on the
        implementation, so that the sizeof shall be respectively 8, 16,
        32 bits.</font></p>
    <p><font size=3D"+1">If this is not backward compatible, would it be
        worth to define a different type?<br>
      </font></p>
    <p><font size=3D"+1"><br>
      </font></p>
    <p><font size=3D"+1">Vicente<br>
      </font></p>
  </div>

</blockquote></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/06e829ca-417b-470c-95ca-c661e8752f79%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/06e829ca-417b-470c-95ca-c661e8752f79=
%40isocpp.org</a>.<br />

------=_Part_1588_279372894.1487709600700--

------=_Part_1587_1044681994.1487709600699--

.


Author: 3dw4rd@verizon.net
Date: Tue, 7 Mar 2017 21:23:38 -0800 (PST)
Raw View
------=_Part_12_1932790725.1488950618864
Content-Type: multipart/alternative;
 boundary="----=_Part_13_552856765.1488950618864"

------=_Part_13_552856765.1488950618864
Content-Type: text/plain; charset=UTF-8



On Tuesday, February 21, 2017 at 3:40:00 PM UTC-5, ricky6565 wrote:
>
> Hi Vicente,
>
> I think the Bitset2 <https://github.com/ClaasBontus/bitset2>library by
> Claas Bontus provides what you are looking for. It's like std::bitset but
> with enhanced functionality. It let's you set the underlying integral type
> of the bitset. In fact, it defaults to uint8_t, uint16_t, or uint32_t if N bits
> fit into those integers. I would like this functionality added to
> std::bitset but, as you said, it would probably be a breaking change.
>
> Riccardo
>

I was just thinking something similar.  Allow the user to specify the
bitset leaf-type:

template<typename LeafTp = unsigned long long, std::size_t Bits = std::
numeric_limits<LeafTp>::digits>
  class bit_array
  {
    // pretty much like bitset except I would add
    using leaf_type = LeafTp;
    leaf_iterator lbegin() //
    leaf_iterator lend(); //
  };


This is flipped relative to Bitset2 in that leaf type comes first and the
template would decide how many leaves based on bits.

So now you could get these small bitsets:
using bitset16 = bit_array<uint16_t>;
etc.

I've heard people want similar choices for a dynamic_bitset:
template<typename LeafTp = unsigned long long>
  class bit_vector
  {
    // pretty much like bitset except I would add
    using leaf_type = LeafTp;
    leaf_iterator lbegin() //
    leaf_iterator lend(); //
  };

People who do encryption wanted to set the size of the leaf and have access
to leaves.
I chose bit_array and bit_vector to have a similar relationship as array
and vector do.

--
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/4238c4e6-51f5-4a2f-94c8-f61ca415e7e0%40isocpp.org.

------=_Part_13_552856765.1488950618864
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Tuesday, February 21, 2017 at 3:40:00 PM UTC-5,=
 ricky6565 wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"l=
tr">Hi Vicente,<div><br></div><div><font face=3D"arial, sans-serif" size=3D=
"2">I think the <a href=3D"https://github.com/ClaasBontus/bitset2" target=
=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://www.go=
ogle.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FClaasBontus%2Fbitset2\x26sa\x3=
dD\x26sntz\x3d1\x26usg\x3dAFQjCNGK_wFmX3DVScYeyAQGywgQn25crA&#39;;return tr=
ue;" onclick=3D"this.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2=
F%2Fgithub.com%2FClaasBontus%2Fbitset2\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAF=
QjCNGK_wFmX3DVScYeyAQGywgQn25crA&#39;;return true;">Bitset2 </a>library by =
Claas Bontus provides what you are looking for. It&#39;s like std::bitset b=
ut with enhanced functionality. It let&#39;s you set the underlying integra=
l type of the bitset. In fact, it=C2=A0<span style=3D"color:rgb(51,51,51)">=
defaults to uint8_t, uint16_t, or uint32_t=C2=A0</span><span style=3D"color=
:rgb(51,51,51)">if N</span><span style=3D"color:rgb(51,51,51)">=C2=A0bits f=
it into those integers.</span>=C2=A0I would like this functionality added t=
o std::bitset but, as you said, it would probably be a breaking change.</fo=
nt></div><div><br></div><div>Riccardo<br></div></div></blockquote><div><br>=
I was just thinking something similar.=C2=A0 Allow the user to specify the =
bitset leaf-type:<br><br><div style=3D"background-color: rgb(250, 250, 250)=
; border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px;=
 overflow-wrap: break-word;" class=3D"prettyprint"><code class=3D"prettypri=
nt"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">template</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">typename</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">Le=
afTp</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">unsigned</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">long</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">long</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify">size_t </sp=
an><span style=3D"color: #606;" class=3D"styled-by-prettify">Bits</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> std</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">numeric_limits</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #606;" class=
=3D"styled-by-prettify">LeafTp</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">&gt;::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">digits</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br>=C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">class</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> bit_array<br>=C2=A0 </span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"styled-b=
y-prettify">// pretty much like bitset except I would add</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">using</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> leaf_type </span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
606;" class=3D"styled-by-prettify">LeafTp</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 leaf_iterator lbegin</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">()</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
800;" class=3D"styled-by-prettify">// </span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 leaf_iterator lend</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">();</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #800;" class=3D"styled-by-prettify">// </span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">};</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br><br></span></div></code></div><br>This is flipp=
ed relative to Bitset2 in that leaf type comes first and the template would=
 decide how many leaves based on bits.<br><br>So now you could get these sm=
all bitsets:<br>using bitset16 =3D bit_array&lt;uint16_t&gt;;<br>etc.<br><b=
r><font size=3D"2">I&#39;ve heard people want similar choices for a dynamic=
_bitset:<br></font><div style=3D"background-color: rgb(250, 250, 250); bord=
er-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; overf=
low-wrap: break-word;" class=3D"prettyprint"><code class=3D"prettyprint"><d=
iv class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by=
-prettify">template</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">typename</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">LeafTp</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">unsigned</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">long</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">long</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br>=C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>class</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> bit=
_vector<br>=C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br>=C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by-pre=
ttify">// pretty much like bitset except I would add</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">using</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> leaf_type </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606=
;" class=3D"styled-by-prettify">LeafTp</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br>=C2=A0 =C2=A0 leaf_iterator lbegin</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">()</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800;"=
 class=3D"styled-by-prettify">// </span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 leaf_iterator lend</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">();</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #8=
00;" class=3D"styled-by-prettify">// </span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">};</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br></span></div></code></div><br>People who do encrypt=
ion wanted to set the size of the leaf and have access to leaves.<br>I chos=
e <span style=3D"font-family: courier new,monospace;">bit_array</span> and =
<span style=3D"font-family: courier new,monospace;">bit_vector</span> to ha=
ve a similar relationship as <span style=3D"font-family: courier new,monosp=
ace;">array</span> and <span style=3D"font-family: courier new,monospace;">=
vector</span> do.<br></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/4238c4e6-51f5-4a2f-94c8-f61ca415e7e0%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/4238c4e6-51f5-4a2f-94c8-f61ca415e7e0=
%40isocpp.org</a>.<br />

------=_Part_13_552856765.1488950618864--

------=_Part_12_1932790725.1488950618864--

.


Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Wed, 8 Mar 2017 13:29:30 +0100
Raw View
This is a multi-part message in MIME format.
--------------9E4DE8759756A3D0C7F84CA2
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable

Le 21/02/2017 =C3=A0 21:40, ricky.65@hotmail.com a =C3=A9crit :
> Hi Vicente,
>
> I think the Bitset2 <https://github.com/ClaasBontus/bitset2>library by=20
> Claas Bontus provides what you are looking for. It's like std::bitset=20
> but with enhanced functionality. It let's you set the underlying=20
> integral type of the bitset. In fact, it defaults to uint8_t,=20
> uint16_t, or uint32_t if N bits fit into those integers. I would like=20
> this functionality added to std::bitset but, as you said, it would=20
> probably be a breaking change.
>
Thanks for the link. Yes, this is close to what I need and in addition=20
generalize well to more than 64 bits.

As we would have span soon,  the data() function should IMO return a span.

The template parameter in=20
https://github.com/ClaasBontus/bitset2/blob/master/bitset2.hpp#L50 seam=20
artificial an unnecesary. A static assert should work here.

A would like a trivial type implementation, so that we can use it where=20
we used before an int16_t e.g.

I don't have a use case for
# Additional constexpr operator |+| for adding two bitset2 objects.
# Additional operators |++|, |--|, |+=3D|.

and IMO this is shouldn't be a numeric type.

Vicente

--=20
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 e=
mail 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/cba4201d-6ef5-8a89-b144-e849f6de5b06%40wanadoo.f=
r.

--------------9E4DE8759756A3D0C7F84CA2
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html>
  <head>
    <meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
  </head>
  <body bgcolor=3D"#FFFFFF" text=3D"#000000">
    <div class=3D"moz-cite-prefix">Le 21/02/2017 =C3=A0 21:40,
      <a class=3D"moz-txt-link-abbreviated" href=3D"mailto:ricky.65@hotmail=
..com">ricky.65@hotmail.com</a> a =C3=A9crit=C2=A0:<br>
    </div>
    <blockquote
      cite=3D"mid:06e829ca-417b-470c-95ca-c661e8752f79@isocpp.org"
      type=3D"cite">
      <div dir=3D"ltr">Hi Vicente,
        <div><br>
        </div>
        <div><font face=3D"arial, sans-serif" size=3D"2">I think the <a
              moz-do-not-send=3D"true"
              href=3D"https://github.com/ClaasBontus/bitset2">Bitset2 </a>l=
ibrary
            by Claas Bontus provides what you are looking for. It's like
            std::bitset but with enhanced functionality. It let's you
            set the underlying integral type of the bitset. In fact, it=C2=
=A0<span
              style=3D"color: rgb(51, 51, 51);">defaults to uint8_t,
              uint16_t, or uint32_t=C2=A0</span><span style=3D"color: rgb(5=
1,
              51, 51);">if N</span><span style=3D"color: rgb(51, 51, 51);">=
=C2=A0bits
              fit into those integers.</span>=C2=A0I would like this
            functionality added to std::bitset but, as you said, it
            would probably be a breaking change.</font></div>
        <div><br>
        </div>
      </div>
    </blockquote>
    Thanks for the link. Yes, this is close to what I need and in
    addition generalize well to more than 64 bits.<br>
    <br>
    As we would have span soon,=C2=A0 the data() function should IMO return=
 a
    span.<br>
    <br>
    The template parameter in
    <a class=3D"moz-txt-link-freetext" href=3D"https://github.com/ClaasBont=
us/bitset2/blob/master/bitset2.hpp#L50">https://github.com/ClaasBontus/bits=
et2/blob/master/bitset2.hpp#L50</a>
    seam artificial an unnecesary. A static assert should work here.<br>
    <br>
    A would like a trivial type implementation, so that we can use it
    where we used before an int16_t e.g.<br>
    <br>
    I don't have a use case for<br>
    <meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf-8=
">
    <li>Additional constexpr operator <code>+</code> for adding two
      bitset2 objects.</li>
    <li>Additional operators <code>++</code>, <code>--</code>, <code>+=3D</=
code>.</li>
    <br>
    and IMO this is shouldn't be a numeric type.<br>
    <br>
    Vicente
  </body>
</html>

<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/cba4201d-6ef5-8a89-b144-e849f6de5b06%=
40wanadoo.fr?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/cba4201d-6ef5-8a89-b144-e849f6de5b06=
%40wanadoo.fr</a>.<br />

--------------9E4DE8759756A3D0C7F84CA2--

.


Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Wed, 8 Mar 2017 13:44:52 +0100
Raw View
This is a multi-part message in MIME format.
--------------3A7744E93E813B6D652594CA
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable

Le 08/03/2017 =C3=A0 06:23, 3dw4rd@verizon.net a =C3=A9crit :
>
>
> On Tuesday, February 21, 2017 at 3:40:00 PM UTC-5, ricky6565 wrote:
>
>     Hi Vicente,
>
>     I think the Bitset2
>     <https://github.com/ClaasBontus/bitset2>library by Claas Bontus
>     provides what you are looking for. It's like std::bitset but with
>     enhanced functionality. It let's you set the underlying integral
>     type of the bitset. In fact, it defaults to uint8_t, uint16_t, or
>     uint32_t if N bits fit into those integers. I would like this
>     functionality added to std::bitset but, as you said, it would
>     probably be a breaking change.
>
>     Riccardo
>
>
> I was just thinking something similar.  Allow the user to specify the=20
> bitset leaf-type:
>
> |
> template<typenameLeafTp=3Dunsignedlonglong,std::size_t=20
> Bits=3Dstd::numeric_limits<LeafTp>::digits>
> classbit_array
> {
> // pretty much like bitset except I would add
> usingleaf_type =3DLeafTp;
>     leaf_iterator lbegin()//
>     leaf_iterator lend();//
> };
>
> |
>
> This is flipped relative to Bitset2 in that leaf type comes first and=20
> the template would decide how many leaves based on bits.
>
> So now you could get these small bitsets:
> using bitset16 =3D bit_array<uint16_t>;
> etc.
>
I believe that both orders could have have usage (see below), an alias=20
templates should help here to have both.
However I don't like the possibility to have bit_array<>. How many bits=20
do we have?

If the data function returns a span<T,N> we don't need the leaf iterator=20
functions.


> I've heard people want similar choices for a dynamic_bitset:
> |
> template<typenameLeafTp=3Dunsignedlonglong>
> classbit_vector
> {
> // pretty much like bitset except I would add
> usingleaf_type =3DLeafTp;
>     leaf_iterator lbegin()//
>     leaf_iterator lend();//
> };
> |
>
> People who do encryption wanted to set the size of the leaf and have=20
> access to leaves.
> I chose bit_array and bit_vector to have a similar relationship as=20
> array and vector do.
For the names I believe we should stay close to bitset and=20
dynamic_bitset. But we can not use bitset :(
I need to think more about your bit_array/bit_vector suggestion, but=20
array/vector don't have set operations. I will go towards bit_set and=20
dynamic_bit_set.
In addition bit_array<int16_t, 10> could be misleading as array<int16_t,=20
10> has a completely different meaning and layout. Do we have 10 int16_t?

Vicente

--=20
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 e=
mail 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/3c737844-0d92-3713-7b7d-06130959a877%40wanadoo.f=
r.

--------------3A7744E93E813B6D652594CA
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html>
  <head>
    <meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
  </head>
  <body bgcolor=3D"#FFFFFF" text=3D"#000000">
    <div class=3D"moz-cite-prefix">Le 08/03/2017 =C3=A0 06:23,
      <a class=3D"moz-txt-link-abbreviated" href=3D"mailto:3dw4rd@verizon.n=
et">3dw4rd@verizon.net</a> a =C3=A9crit=C2=A0:<br>
    </div>
    <blockquote
      cite=3D"mid:4238c4e6-51f5-4a2f-94c8-f61ca415e7e0@isocpp.org"
      type=3D"cite">
      <div dir=3D"ltr"><br>
        <br>
        On Tuesday, February 21, 2017 at 3:40:00 PM UTC-5, ricky6565
        wrote:
        <blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:
          0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
          <div dir=3D"ltr">Hi Vicente,
            <div><br>
            </div>
            <div><font face=3D"arial, sans-serif" size=3D"2">I think the <a
                  moz-do-not-send=3D"true"
                  href=3D"https://github.com/ClaasBontus/bitset2"
                  target=3D"_blank" rel=3D"nofollow"
onmousedown=3D"this.href=3D'https://www.google.com/url?q\x3dhttps%3A%2F%2Fg=
ithub.com%2FClaasBontus%2Fbitset2\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNG=
K_wFmX3DVScYeyAQGywgQn25crA';return
                  true;"
onclick=3D"this.href=3D'https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithu=
b.com%2FClaasBontus%2Fbitset2\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGK_wF=
mX3DVScYeyAQGywgQn25crA';return
                  true;">Bitset2 </a>library by Claas Bontus provides
                what you are looking for. It's like std::bitset but with
                enhanced functionality. It let's you set the underlying
                integral type of the bitset. In fact, it=C2=A0<span
                  style=3D"color:rgb(51,51,51)">defaults to uint8_t,
                  uint16_t, or uint32_t=C2=A0</span><span
                  style=3D"color:rgb(51,51,51)">if N</span><span
                  style=3D"color:rgb(51,51,51)">=C2=A0bits fit into those
                  integers.</span>=C2=A0I would like this functionality add=
ed
                to std::bitset but, as you said, it would probably be a
                breaking change.</font></div>
            <div><br>
            </div>
            <div>Riccardo<br>
            </div>
          </div>
        </blockquote>
        <div><br>
          I was just thinking something similar.=C2=A0 Allow the user to
          specify the bitset leaf-type:<br>
          <br>
          <div style=3D"background-color: rgb(250, 250, 250);
            border-color: rgb(187, 187, 187); border-style: solid;
            border-width: 1px; overflow-wrap: break-word;"
            class=3D"prettyprint"><code class=3D"prettyprint">
              <div class=3D"subprettyprint"><span style=3D"color: #008;"
                  class=3D"styled-by-prettify">template</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">typen=
ame</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #606;" class=3D"styled-by-prettify">LeafT=
p</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">=3D</=
span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">unsig=
ned</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">long<=
/span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">long<=
/span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> std<=
/span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">::</s=
pan><span
                  style=3D"color: #000;" class=3D"styled-by-prettify">size_=
t
                </span><span style=3D"color: #606;"
                  class=3D"styled-by-prettify">Bits</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">=3D</=
span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> std<=
/span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">::</s=
pan><span
                  style=3D"color: #000;" class=3D"styled-by-prettify">numer=
ic_limits</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><span
                  style=3D"color: #606;" class=3D"styled-by-prettify">LeafT=
p</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&gt;:=
:</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify">digit=
s</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&gt;<=
/span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                  =C2=A0 </span><span style=3D"color: #008;"
                  class=3D"styled-by-prettify">class</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify">
                  bit_array<br>
                  =C2=A0 </span><span style=3D"color: #660;"
                  class=3D"styled-by-prettify">{</span><span style=3D"color=
:
                  #000;" class=3D"styled-by-prettify"><br>
                  =C2=A0 =C2=A0 </span><span style=3D"color: #800;"
                  class=3D"styled-by-prettify">// pretty much like bitset
                  except I would add</span><span style=3D"color: #000;"
                  class=3D"styled-by-prettify"><br>
                  =C2=A0 =C2=A0 </span><span style=3D"color: #008;"
                  class=3D"styled-by-prettify">using</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify">
                  leaf_type </span><span style=3D"color: #660;"
                  class=3D"styled-by-prettify">=3D</span><span style=3D"col=
or:
                  #000;" class=3D"styled-by-prettify"> </span><span
                  style=3D"color: #606;" class=3D"styled-by-prettify">LeafT=
p</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">;</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                  =C2=A0 =C2=A0 leaf_iterator lbegin</span><span style=3D"c=
olor:
                  #660;" class=3D"styled-by-prettify">()</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #800;" class=3D"styled-by-prettify">// </=
span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                  =C2=A0 =C2=A0 leaf_iterator lend</span><span style=3D"col=
or:
                  #660;" class=3D"styled-by-prettify">();</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #800;" class=3D"styled-by-prettify">// </=
span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                  =C2=A0 </span><span style=3D"color: #660;"
                  class=3D"styled-by-prettify">};</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                  <br>
                </span></div>
            </code></div>
          <br>
          This is flipped relative to Bitset2 in that leaf type comes
          first and the template would decide how many leaves based on
          bits.<br>
          <br>
          So now you could get these small bitsets:<br>
          using bitset16 =3D bit_array&lt;uint16_t&gt;;<br>
          etc.<br>
          <br>
        </div>
      </div>
    </blockquote>
    I believe that both orders could have have usage (see below), an
    alias templates should help here to have both.<br>
    However I don't like the possibility to have bit_array&lt;&gt;. How
    many bits do we have?<br>
    <br>
    If the data function returns a span&lt;T,N&gt; we don't need the
    leaf iterator functions.<br>
    =C2=A0<br>
    <br>
    <blockquote
      cite=3D"mid:4238c4e6-51f5-4a2f-94c8-f61ca415e7e0@isocpp.org"
      type=3D"cite">
      <div dir=3D"ltr">
        <div><font size=3D"2">I've heard people want similar choices for a
            dynamic_bitset:<br>
          </font>
          <div style=3D"background-color: rgb(250, 250, 250);
            border-color: rgb(187, 187, 187); border-style: solid;
            border-width: 1px; overflow-wrap: break-word;"
            class=3D"prettyprint"><code class=3D"prettyprint">
              <div class=3D"subprettyprint"><span style=3D"color: #008;"
                  class=3D"styled-by-prettify">template</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">typen=
ame</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #606;" class=3D"styled-by-prettify">LeafT=
p</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">=3D</=
span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">unsig=
ned</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">long<=
/span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">long<=
/span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&gt;<=
/span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                  =C2=A0 </span><span style=3D"color: #008;"
                  class=3D"styled-by-prettify">class</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify">
                  bit_vector<br>
                  =C2=A0 </span><span style=3D"color: #660;"
                  class=3D"styled-by-prettify">{</span><span style=3D"color=
:
                  #000;" class=3D"styled-by-prettify"><br>
                  =C2=A0 =C2=A0 </span><span style=3D"color: #800;"
                  class=3D"styled-by-prettify">// pretty much like bitset
                  except I would add</span><span style=3D"color: #000;"
                  class=3D"styled-by-prettify"><br>
                  =C2=A0 =C2=A0 </span><span style=3D"color: #008;"
                  class=3D"styled-by-prettify">using</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify">
                  leaf_type </span><span style=3D"color: #660;"
                  class=3D"styled-by-prettify">=3D</span><span style=3D"col=
or:
                  #000;" class=3D"styled-by-prettify"> </span><span
                  style=3D"color: #606;" class=3D"styled-by-prettify">LeafT=
p</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">;</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                  =C2=A0 =C2=A0 leaf_iterator lbegin</span><span style=3D"c=
olor:
                  #660;" class=3D"styled-by-prettify">()</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #800;" class=3D"styled-by-prettify">// </=
span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                  =C2=A0 =C2=A0 leaf_iterator lend</span><span style=3D"col=
or:
                  #660;" class=3D"styled-by-prettify">();</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #800;" class=3D"styled-by-prettify">// </=
span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                  =C2=A0 </span><span style=3D"color: #660;"
                  class=3D"styled-by-prettify">};</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                </span></div>
            </code></div>
          <br>
          People who do encryption wanted to set the size of the leaf
          and have access to leaves.<br>
          I chose <span style=3D"font-family: courier new,monospace;">bit_a=
rray</span>
          and <span style=3D"font-family: courier new,monospace;">bit_vecto=
r</span>
          to have a similar relationship as <span style=3D"font-family:
            courier new,monospace;">array</span> and <span
            style=3D"font-family: courier new,monospace;">vector</span>
          do.<br>
        </div>
      </div>
    </blockquote>
    For the names I believe we should stay close to bitset and
    dynamic_bitset. But we can not use bitset :(<br>
    I need to think more about your bit_array/bit_vector suggestion, but
    array/vector don't have set operations. I will go towards bit_set
    and dynamic_bit_set.<br>
    In addition bit_array&lt;int16_t, 10&gt; could be misleading as
    array&lt;int16_t, 10&gt; has a completely different meaning and
    layout. Do we have 10 int16_t?<br>
    <br>
    Vicente<br>
  </body>
</html>

<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/3c737844-0d92-3713-7b7d-06130959a877%=
40wanadoo.fr?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/3c737844-0d92-3713-7b7d-06130959a877=
%40wanadoo.fr</a>.<br />

--------------3A7744E93E813B6D652594CA--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Wed, 8 Mar 2017 06:38:55 -0800 (PST)
Raw View
------=_Part_209_1591212714.1488983935412
Content-Type: multipart/alternative;
 boundary="----=_Part_210_1595717642.1488983935412"

------=_Part_210_1595717642.1488983935412
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



On Wednesday, March 8, 2017 at 7:29:33 AM UTC-5, Vicente J. Botet Escriba=
=20
wrote:
>
> Le 21/02/2017 =C3=A0 21:40, rick...@hotmail.com <javascript:> a =C3=A9cri=
t :
>
> Hi Vicente,=20
>
> I think the Bitset2 <https://github.com/ClaasBontus/bitset2>library by=20
> Claas Bontus provides what you are looking for. It's like std::bitset but=
=20
> with enhanced functionality. It let's you set the underlying integral typ=
e=20
> of the bitset. In fact, it defaults to uint8_t, uint16_t, or uint32_t if =
N bits=20
> fit into those integers. I would like this functionality added to=20
> std::bitset but, as you said, it would probably be a breaking change.
>
> Thanks for the link. Yes, this is close to what I need and in addition=20
> generalize well to more than 64 bits.
>
> As we would have span soon,  the data() function should IMO return a span=
..
>

In which case it should not be called `data`. The current uses of that=20
function return a pointer, not a `span` or a range.

--=20
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 e=
mail 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/538fc521-2e25-4788-b3cd-a065d1151671%40isocpp.or=
g.

------=_Part_210_1595717642.1488983935412
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Wednesday, March 8, 2017 at 7:29:33 AM UTC-5, V=
icente J. Botet Escriba wrote:<blockquote class=3D"gmail_quote" style=3D"ma=
rgin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
 =20
   =20
 =20
  <div bgcolor=3D"#FFFFFF" text=3D"#000000">
    <div>Le 21/02/2017 =C3=A0 21:40,
      <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"ou=
wQDnPPCwAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&#3=
9;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true;"=
>rick...@hotmail.com</a> a =C3=A9crit=C2=A0:<br>
    </div>
    <blockquote type=3D"cite">
      <div dir=3D"ltr">Hi Vicente,
        <div><br>
        </div>
        <div><font size=3D"2" face=3D"arial, sans-serif">I think the <a hre=
f=3D"https://github.com/ClaasBontus/bitset2" target=3D"_blank" rel=3D"nofol=
low" onmousedown=3D"this.href=3D&#39;https://www.google.com/url?q\x3dhttps%=
3A%2F%2Fgithub.com%2FClaasBontus%2Fbitset2\x26sa\x3dD\x26sntz\x3d1\x26usg\x=
3dAFQjCNGK_wFmX3DVScYeyAQGywgQn25crA&#39;;return true;" onclick=3D"this.hre=
f=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FClaasBo=
ntus%2Fbitset2\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGK_wFmX3DVScYeyAQGyw=
gQn25crA&#39;;return true;">Bitset2 </a>library
            by Claas Bontus provides what you are looking for. It&#39;s lik=
e
            std::bitset but with enhanced functionality. It let&#39;s you
            set the underlying integral type of the bitset. In fact, it=C2=
=A0<span style=3D"color:rgb(51,51,51)">defaults to uint8_t,
              uint16_t, or uint32_t=C2=A0</span><span style=3D"color:rgb(51=
,51,51)">if N</span><span style=3D"color:rgb(51,51,51)">=C2=A0bits
              fit into those integers.</span>=C2=A0I would like this
            functionality added to std::bitset but, as you said, it
            would probably be a breaking change.</font></div>
        <div><br>
        </div>
      </div>
    </blockquote>
    Thanks for the link. Yes, this is close to what I need and in
    addition generalize well to more than 64 bits.<br>
    <br>
    As we would have span soon,=C2=A0 the data() function should IMO return=
 a
    span.<br></div></blockquote><div><br>In which case it should not be cal=
led `data`. The current uses of that function return a pointer, not a `span=
` or a range.</div><br></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/538fc521-2e25-4788-b3cd-a065d1151671%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/538fc521-2e25-4788-b3cd-a065d1151671=
%40isocpp.org</a>.<br />

------=_Part_210_1595717642.1488983935412--

------=_Part_209_1591212714.1488983935412--

.


Author: 3dw4rd@verizon.net
Date: Wed, 8 Mar 2017 14:26:07 -0800 (PST)
Raw View
------=_Part_470_813546826.1489011967203
Content-Type: multipart/alternative;
 boundary="----=_Part_471_2060387384.1489011967203"

------=_Part_471_2060387384.1489011967203
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



On Wednesday, March 8, 2017 at 7:44:56 AM UTC-5, Vicente J. Botet Escriba=
=20
wrote:
>
> Le 08/03/2017 =C3=A0 06:23, 3dw...@verizon.net <javascript:> a =C3=A9crit=
 :
>
>
>
> On Tuesday, February 21, 2017 at 3:40:00 PM UTC-5, ricky6565 wrote:=20
>>
>> Hi Vicente,=20
>>
>> I think the Bitset2 <https://github.com/ClaasBontus/bitset2>library by=
=20
>> Claas Bontus provides what you are looking for. It's like std::bitset bu=
t=20
>> with enhanced functionality. It let's you set the underlying integral ty=
pe=20
>> of the bitset. In fact, it defaults to uint8_t, uint16_t, or uint32_t if=
=20
>> N bits fit into those integers. I would like this functionality added to=
=20
>> std::bitset but, as you said, it would probably be a breaking change.
>>
>> Riccardo
>>
>
> I was just thinking something similar.  Allow the user to specify the=20
> bitset leaf-type:
>
> template<typename LeafTp =3D unsigned long long, std::size_t Bits =3D std=
::
> numeric_limits<LeafTp>::digits>
>   class bit_array
>   {
>     // pretty much like bitset except I would add
>     using leaf_type =3D LeafTp;
>     leaf_iterator lbegin() //=20
>     leaf_iterator lend(); //=20
>   };
>
>
> This is flipped relative to Bitset2 in that leaf type comes first and the=
=20
> template would decide how many leaves based on bits.
>
> So now you could get these small bitsets:
> using bitset16 =3D bit_array<uint16_t>;
> etc.
>
> I believe that both orders could have have usage (see below), an alias=20
> templates should help here to have both.
> However I don't like the possibility to have bit_array<>. How many bits d=
o=20
> we have?
>

In this case bit_array<> is bit_array<unsigned long long,=20
std::numeric_limits<unsigned long long>::digits>
so on my system, 64-bits.  Perhaps we want a fixed size integral type as=20
the default type.
We could also not a a default type.
=20

> If the data function returns a span<T,N> we don't need the leaf iterator=
=20
> functions.
>
=20
This is good.  My one worry was that my API was getting baroque with both=
=20
vector and bitset access.

I've heard people want similar choices for a dynamic_bitset:
template<typename LeafTp =3D unsigned long long>
  class bit_vector
  {
    // pretty much like bitset except I would add
    using leaf_type =3D LeafTp;
    leaf_iterator lbegin() //=20
    leaf_iterator lend(); //=20
  };

People who do encryption wanted to set the size of the leaf and have access=
=20
to leaves.
I chose bit_array and bit_vector to have a similar relationship as array=20
and vector do.

For the names I believe we should stay close to bitset and dynamic_bitset.=
=20
But we can not use bitset :(
I need to think more about your bit_array/bit_vector suggestion, but=20
array/vector don't have set operations. I will go towards bit_set and=20
dynamic_bit_set.
In addition bit_array<int16_t, 10> could be misleading as array<int16_t,=20
10> has a completely different meaning and layout. Do we have 10 int16_t?

We could bikeshed for ever ;-)  Maybe bitvec and dynamic_bitvec?
I see your point about confusion though.

I could almost see a reason for a UDL bits, and bytes.  APIs could take=20
either.
They would *not *convert to ints automatically.  APIs taking number of=20
elements (array, vector, ...) would remain unchanged.
This is almost like <units>.
But numeric and bitset types would be able to take bits and bytes.  These=
=20
UDLs would return bit_size_t and byte_size_t that could inter-convert=20
between each other but not to integers without a to_size_t() or something.
This might help the fixed_point people and bit utility.  Or it might annoy=
=20
them.



Vicente

>

--=20
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 e=
mail 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/fe192db2-f40d-43cf-a251-9e456cd3430c%40isocpp.or=
g.

------=_Part_471_2060387384.1489011967203
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Wednesday, March 8, 2017 at 7:44:56 AM UTC-5, V=
icente J. Botet Escriba wrote:<blockquote class=3D"gmail_quote" style=3D"ma=
rgin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
 =20
   =20
 =20
  <div bgcolor=3D"#FFFFFF" text=3D"#000000">
    <div>Le 08/03/2017 =C3=A0 06:23,
      <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"Bx=
Cl0knQCwAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&#3=
9;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true;"=
>3dw...@verizon.net</a> a =C3=A9crit=C2=A0:<br>
    </div>
    <blockquote type=3D"cite">
      <div dir=3D"ltr"><br>
        <br>
        On Tuesday, February 21, 2017 at 3:40:00 PM UTC-5, ricky6565
        wrote:
        <blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8=
ex;border-left:1px #ccc solid;padding-left:1ex">
          <div dir=3D"ltr">Hi Vicente,
            <div><br>
            </div>
            <div><font face=3D"arial, sans-serif" size=3D"2">I think the <a=
 href=3D"https://github.com/ClaasBontus/bitset2" rel=3D"nofollow" target=3D=
"_blank" onmousedown=3D"this.href=3D&#39;https://www.google.com/url?q\x3dht=
tps%3A%2F%2Fgithub.com%2FClaasBontus%2Fbitset2\x26sa\x3dD\x26sntz\x3d1\x26u=
sg\x3dAFQjCNGK_wFmX3DVScYeyAQGywgQn25crA&#39;;return true;" onclick=3D"this=
..href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FCla=
asBontus%2Fbitset2\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGK_wFmX3DVScYeyA=
QGywgQn25crA&#39;;return true;">Bitset2 </a>library by Claas Bontus provide=
s
                what you are looking for. It&#39;s like std::bitset but wit=
h
                enhanced functionality. It let&#39;s you set the underlying
                integral type of the bitset. In fact, it=C2=A0<span style=
=3D"color:rgb(51,51,51)">defaults to uint8_t,
                  uint16_t, or uint32_t=C2=A0</span><span style=3D"color:rg=
b(51,51,51)">if N</span><span style=3D"color:rgb(51,51,51)">=C2=A0bits fit =
into those
                  integers.</span>=C2=A0I would like this functionality add=
ed
                to std::bitset but, as you said, it would probably be a
                breaking change.</font></div>
            <div><br>
            </div>
            <div>Riccardo<br>
            </div>
          </div>
        </blockquote>
        <div><br>
          I was just thinking something similar.=C2=A0 Allow the user to
          specify the bitset leaf-type:<br>
          <br>
          <div style=3D"background-color:rgb(250,250,250);border-color:rgb(=
187,187,187);border-style:solid;border-width:1px"><code>
              <div><span style=3D"color:#008">template</span><span style=3D=
"color:#660">&lt;</span><span style=3D"color:#008">typename</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#606">LeafTp</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#660">=3D</span><span style=
=3D"color:#000"> </span><span style=3D"color:#008">unsigned</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#008">long</span><span style=
=3D"color:#000"> </span><span style=3D"color:#008">long</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"> std</span><span style=
=3D"color:#660">::</span><span style=3D"color:#000">size_t
                </span><span style=3D"color:#606">Bits</span><span style=3D=
"color:#000"> </span><span style=3D"color:#660">=3D</span><span style=3D"co=
lor:#000"> std</span><span style=3D"color:#660">::</span><span style=3D"col=
or:#000">numeric_limits</span><span style=3D"color:#660">&lt;</span><span s=
tyle=3D"color:#606">LeafTp</span><span style=3D"color:#660">&gt;::</span><s=
pan style=3D"color:#000">d<wbr>igits</span><span style=3D"color:#660">&gt;<=
/span><span style=3D"color:#000"><br>
                  =C2=A0 </span><span style=3D"color:#008">class</span><spa=
n style=3D"color:#000">
                  bit_array<br>
                  =C2=A0 </span><span style=3D"color:#660">{</span><span st=
yle=3D"color:#000"><br>
                  =C2=A0 =C2=A0 </span><span style=3D"color:#800">// pretty=
 much like bitset
                  except I would add</span><span style=3D"color:#000"><br>
                  =C2=A0 =C2=A0 </span><span style=3D"color:#008">using</sp=
an><span style=3D"color:#000">
                  leaf_type </span><span style=3D"color:#660">=3D</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#606">LeafTp</span><sp=
an style=3D"color:#660">;</span><span style=3D"color:#000"><br>
                  =C2=A0 =C2=A0 leaf_iterator lbegin</span><span style=3D"c=
olor:#660">()</span><span style=3D"color:#000"> </span><span style=3D"color=
:#800">// </span><span style=3D"color:#000"><br>
                  =C2=A0 =C2=A0 leaf_iterator lend</span><span style=3D"col=
or:#660">();</span><span style=3D"color:#000"> </span><span style=3D"color:=
#800">// </span><span style=3D"color:#000"><br>
                  =C2=A0 </span><span style=3D"color:#660">};</span><span s=
tyle=3D"color:#000"><br>
                  <br>
                </span></div>
            </code></div>
          <br>
          This is flipped relative to Bitset2 in that leaf type comes
          first and the template would decide how many leaves based on
          bits.<br>
          <br>
          So now you could get these small bitsets:<br>
          using bitset16 =3D bit_array&lt;uint16_t&gt;;<br>
          etc.<br>
          <br>
        </div>
      </div>
    </blockquote>
    I believe that both orders could have have usage (see below), an
    alias templates should help here to have both.<br>
    However I don&#39;t like the possibility to have bit_array&lt;&gt;. How
    many bits do we have?<br></div></blockquote><div><br>In this case bit_a=
rray&lt;&gt; is bit_array&lt;unsigned long long, std::numeric_limits&lt;uns=
igned long long&gt;::digits&gt;<br>so on my system, 64-bits.=C2=A0 Perhaps =
we want a fixed size integral type as the default type.<br>We could also no=
t a a default type.<br></div><div>=C2=A0</div><blockquote class=3D"gmail_qu=
ote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padd=
ing-left: 1ex;"><div bgcolor=3D"#FFFFFF" text=3D"#000000">
    If the data function returns a span&lt;T,N&gt; we don&#39;t need the
    leaf iterator functions.<br></div></blockquote><div bgcolor=3D"#FFFFFF"=
 text=3D"#000000">=C2=A0<br>This is good.=C2=A0 My one worry was that my AP=
I was getting baroque with both vector and bitset access.<br><br>
    <blockquote type=3D"cite">
      <div dir=3D"ltr">
        <div><font size=3D"2">I&#39;ve heard people want similar choices fo=
r a
            dynamic_bitset:<br>
          </font>
          <div style=3D"background-color:rgb(250,250,250);border-color:rgb(=
187,187,187);border-style:solid;border-width:1px"><code>
              <div><span style=3D"color:#008">template</span><span style=3D=
"color:#660">&lt;</span><span style=3D"color:#008">typename</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#606">LeafTp</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#660">=3D</span><span style=
=3D"color:#000"> </span><span style=3D"color:#008">unsigned</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#008">long</span><span style=
=3D"color:#000"> </span><span style=3D"color:#008">long</span><span style=
=3D"color:#660">&gt;</span><span style=3D"color:#000"><br>
                  =C2=A0 </span><span style=3D"color:#008">class</span><spa=
n style=3D"color:#000">
                  bit_vector<br>
                  =C2=A0 </span><span style=3D"color:#660">{</span><span st=
yle=3D"color:#000"><br>
                  =C2=A0 =C2=A0 </span><span style=3D"color:#800">// pretty=
 much like bitset
                  except I would add</span><span style=3D"color:#000"><br>
                  =C2=A0 =C2=A0 </span><span style=3D"color:#008">using</sp=
an><span style=3D"color:#000">
                  leaf_type </span><span style=3D"color:#660">=3D</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#606">LeafTp</span><sp=
an style=3D"color:#660">;</span><span style=3D"color:#000"><br>
                  =C2=A0 =C2=A0 leaf_iterator lbegin</span><span style=3D"c=
olor:#660">()</span><span style=3D"color:#000"> </span><span style=3D"color=
:#800">// </span><span style=3D"color:#000"><br>
                  =C2=A0 =C2=A0 leaf_iterator lend</span><span style=3D"col=
or:#660">();</span><span style=3D"color:#000"> </span><span style=3D"color:=
#800">// </span><span style=3D"color:#000"><br>
                  =C2=A0 </span><span style=3D"color:#660">};</span><span s=
tyle=3D"color:#000"><br>
                </span></div>
            </code></div>
          <br>
          People who do encryption wanted to set the size of the leaf
          and have access to leaves.<br>
          I chose <span style=3D"font-family:courier new,monospace">bit_arr=
ay</span>
          and <span style=3D"font-family:courier new,monospace">bit_vector<=
/span>
          to have a similar relationship as <span style=3D"font-family:cour=
ier new,monospace">array</span> and <span style=3D"font-family:courier new,=
monospace">vector</span>
          do.<br>
        </div>
      </div>
    </blockquote>
    For the names I believe we should stay close to bitset and
    dynamic_bitset. But we can not use bitset :(<br>
    I need to think more about your bit_array/bit_vector suggestion, but
    array/vector don&#39;t have set operations. I will go towards bit_set
    and dynamic_bit_set.<br>
    In addition bit_array&lt;int16_t, 10&gt; could be misleading as
    array&lt;int16_t, 10&gt; has a completely different meaning and
    layout. Do we have 10 int16_t?<br><br>We could bikeshed for ever ;-)=C2=
=A0 Maybe bitvec and dynamic_bitvec?<br>I see your point about confusion th=
ough.<br><br>I could almost see a reason for a UDL bits, and bytes.=C2=A0 A=
PIs could take either.<br>They would <b>not </b>convert to ints automatical=
ly.=C2=A0 APIs taking number of elements (array, vector, ...) would remain =
unchanged.<br>This is almost like &lt;units&gt;.<br>But numeric and bitset =
types would be able to take bits and bytes.=C2=A0 These UDLs would return b=
it_size_t and byte_size_t that could inter-convert between each other but n=
ot to integers without a to_size_t() or something.<br>This might help the f=
ixed_point people and bit utility.=C2=A0 Or it might annoy them.<br><br><br=
>
    <br>
    Vicente<br>
  </div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0=
..8ex;border-left: 1px #ccc solid;padding-left: 1ex;">

</blockquote></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/fe192db2-f40d-43cf-a251-9e456cd3430c%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/fe192db2-f40d-43cf-a251-9e456cd3430c=
%40isocpp.org</a>.<br />

------=_Part_471_2060387384.1489011967203--

------=_Part_470_813546826.1489011967203--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Wed, 8 Mar 2017 15:22:45 -0800 (PST)
Raw View
------=_Part_507_675719803.1489015365692
Content-Type: multipart/alternative;
 boundary="----=_Part_508_416094480.1489015365692"

------=_Part_508_416094480.1489015365692
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



On Wednesday, March 8, 2017 at 5:26:07 PM UTC-5, 3dw...@verizon.net wrote:
>
>
>
> On Wednesday, March 8, 2017 at 7:44:56 AM UTC-5, Vicente J. Botet Escriba=
=20
> wrote:
>>
>> Le 08/03/2017 =C3=A0 06:23, 3dw...@verizon.net a =C3=A9crit :
>>
>>
>>
>> On Tuesday, February 21, 2017 at 3:40:00 PM UTC-5, ricky6565 wrote:=20
>>>
>>> Hi Vicente,=20
>>>
>>> I think the Bitset2 <https://github.com/ClaasBontus/bitset2>library by=
=20
>>> Claas Bontus provides what you are looking for. It's like std::bitset b=
ut=20
>>> with enhanced functionality. It let's you set the underlying integral t=
ype=20
>>> of the bitset. In fact, it defaults to uint8_t, uint16_t, or uint32_t i=
f=20
>>> N bits fit into those integers. I would like this functionality added=
=20
>>> to std::bitset but, as you said, it would probably be a breaking change=
..
>>>
>>> Riccardo
>>>
>>
>> I was just thinking something similar.  Allow the user to specify the=20
>> bitset leaf-type:
>>
>> template<typename LeafTp =3D unsigned long long, std::size_t Bits =3D st=
d::
>> numeric_limits<LeafTp>::digits>
>>   class bit_array
>>   {
>>     // pretty much like bitset except I would add
>>     using leaf_type =3D LeafTp;
>>     leaf_iterator lbegin() //=20
>>     leaf_iterator lend(); //=20
>>   };
>>
>>
>> This is flipped relative to Bitset2 in that leaf type comes first and th=
e=20
>> template would decide how many leaves based on bits.
>>
>> So now you could get these small bitsets:
>> using bitset16 =3D bit_array<uint16_t>;
>> etc.
>>
>> I believe that both orders could have have usage (see below), an alias=
=20
>> templates should help here to have both.
>> However I don't like the possibility to have bit_array<>. How many bits=
=20
>> do we have?
>>
>
> In this case bit_array<> is bit_array<unsigned long long,=20
> std::numeric_limits<unsigned long long>::digits>
> so on my system, 64-bits.  Perhaps we want a fixed size integral type as=
=20
> the default type.
>

You can't use a type that implementations are not required to support.

We could also not a a default type.
>

Um, why not? Really, what's wrong with `unsigned int`? There are plenty of=
=20
people who don't care about what the "leaf" type is; they just want a=20
convenient class for doing bit manipulation with. Why make things=20
needlessly difficult for them?

>

--=20
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 e=
mail 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/dd7dfbe0-8a9e-4fe4-b37a-312c495f648f%40isocpp.or=
g.

------=_Part_508_416094480.1489015365692
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Wednesday, March 8, 2017 at 5:26:07 PM UTC-5, 3=
dw...@verizon.net wrote:<blockquote class=3D"gmail_quote" style=3D"margin: =
0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div d=
ir=3D"ltr"><br><br>On Wednesday, March 8, 2017 at 7:44:56 AM UTC-5, Vicente=
 J. Botet Escriba wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0=
;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
 =20
   =20
 =20
  <div bgcolor=3D"#FFFFFF" text=3D"#000000">
    <div>Le 08/03/2017 =C3=A0 06:23,
      <a rel=3D"nofollow">3dw...@verizon.net</a> a =C3=A9crit=C2=A0:<br>
    </div>
    <blockquote type=3D"cite">
      <div dir=3D"ltr"><br>
        <br>
        On Tuesday, February 21, 2017 at 3:40:00 PM UTC-5, ricky6565
        wrote:
        <blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8=
ex;border-left:1px #ccc solid;padding-left:1ex">
          <div dir=3D"ltr">Hi Vicente,
            <div><br>
            </div>
            <div><font size=3D"2" face=3D"arial, sans-serif">I think the <a=
 href=3D"https://github.com/ClaasBontus/bitset2" rel=3D"nofollow" target=3D=
"_blank" onmousedown=3D"this.href=3D&#39;https://www.google.com/url?q\x3dht=
tps%3A%2F%2Fgithub.com%2FClaasBontus%2Fbitset2\x26sa\x3dD\x26sntz\x3d1\x26u=
sg\x3dAFQjCNGK_wFmX3DVScYeyAQGywgQn25crA&#39;;return true;" onclick=3D"this=
..href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FCla=
asBontus%2Fbitset2\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGK_wFmX3DVScYeyA=
QGywgQn25crA&#39;;return true;">Bitset2 </a>library by Claas Bontus provide=
s
                what you are looking for. It&#39;s like std::bitset but wit=
h
                enhanced functionality. It let&#39;s you set the underlying
                integral type of the bitset. In fact, it=C2=A0<span style=
=3D"color:rgb(51,51,51)">defaults to uint8_t,
                  uint16_t, or uint32_t=C2=A0</span><span style=3D"color:rg=
b(51,51,51)">if N</span><span style=3D"color:rgb(51,51,51)">=C2=A0bits fit =
into those
                  integers.</span>=C2=A0I would like this functionality add=
ed
                to std::bitset but, as you said, it would probably be a
                breaking change.</font></div>
            <div><br>
            </div>
            <div>Riccardo<br>
            </div>
          </div>
        </blockquote>
        <div><br>
          I was just thinking something similar.=C2=A0 Allow the user to
          specify the bitset leaf-type:<br>
          <br>
          <div style=3D"background-color:rgb(250,250,250);border-color:rgb(=
187,187,187);border-style:solid;border-width:1px"><code>
              <div><span style=3D"color:#008">template</span><span style=3D=
"color:#660">&lt;</span><span style=3D"color:#008">typename</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#606">LeafTp</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#660">=3D</span><span style=
=3D"color:#000"> </span><span style=3D"color:#008">unsigned</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#008">long</span><span style=
=3D"color:#000"> </span><span style=3D"color:#008">long</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"> std</span><span style=
=3D"color:#660">::</span><span style=3D"color:#000">size_t
                </span><span style=3D"color:#606">Bits</span><span style=3D=
"color:#000"> </span><span style=3D"color:#660">=3D</span><span style=3D"co=
lor:#000"> std</span><span style=3D"color:#660">::</span><span style=3D"col=
or:#000">numeric_limits</span><span style=3D"color:#660">&lt;</span><span s=
tyle=3D"color:#606">LeafTp</span><span style=3D"color:#660">&gt;::</span><s=
pan style=3D"color:#000">d<wbr>igits</span><span style=3D"color:#660">&gt;<=
/span><span style=3D"color:#000"><br>
                  =C2=A0 </span><span style=3D"color:#008">class</span><spa=
n style=3D"color:#000">
                  bit_array<br>
                  =C2=A0 </span><span style=3D"color:#660">{</span><span st=
yle=3D"color:#000"><br>
                  =C2=A0 =C2=A0 </span><span style=3D"color:#800">// pretty=
 much like bitset
                  except I would add</span><span style=3D"color:#000"><br>
                  =C2=A0 =C2=A0 </span><span style=3D"color:#008">using</sp=
an><span style=3D"color:#000">
                  leaf_type </span><span style=3D"color:#660">=3D</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#606">LeafTp</span><sp=
an style=3D"color:#660">;</span><span style=3D"color:#000"><br>
                  =C2=A0 =C2=A0 leaf_iterator lbegin</span><span style=3D"c=
olor:#660">()</span><span style=3D"color:#000"> </span><span style=3D"color=
:#800">// </span><span style=3D"color:#000"><br>
                  =C2=A0 =C2=A0 leaf_iterator lend</span><span style=3D"col=
or:#660">();</span><span style=3D"color:#000"> </span><span style=3D"color:=
#800">// </span><span style=3D"color:#000"><br>
                  =C2=A0 </span><span style=3D"color:#660">};</span><span s=
tyle=3D"color:#000"><br>
                  <br>
                </span></div>
            </code></div>
          <br>
          This is flipped relative to Bitset2 in that leaf type comes
          first and the template would decide how many leaves based on
          bits.<br>
          <br>
          So now you could get these small bitsets:<br>
          using bitset16 =3D bit_array&lt;uint16_t&gt;;<br>
          etc.<br>
          <br>
        </div>
      </div>
    </blockquote>
    I believe that both orders could have have usage (see below), an
    alias templates should help here to have both.<br>
    However I don&#39;t like the possibility to have bit_array&lt;&gt;. How
    many bits do we have?<br></div></blockquote><div><br>In this case bit_a=
rray&lt;&gt; is bit_array&lt;unsigned long long, std::numeric_limits&lt;uns=
igned long long&gt;::digits&gt;<br>so on my system, 64-bits.=C2=A0 Perhaps =
we want a fixed size integral type as the default type.<br></div></div></bl=
ockquote><div><br>You can&#39;t use a type that implementations are not req=
uired to support.<br><br></div><blockquote class=3D"gmail_quote" style=3D"m=
argin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"=
><div dir=3D"ltr"><div>We could also not a a default type.<br></div></div><=
/blockquote><div><br>Um, why not? Really, what&#39;s wrong with `unsigned i=
nt`? There are plenty of people who don&#39;t care about what the &quot;lea=
f&quot; type is; they just want a convenient class for doing bit manipulati=
on with. Why make things needlessly difficult for them?<br></div><blockquot=
e class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: =
1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><blockquote class=3D"gm=
ail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;p=
adding-left:1ex">

</blockquote></div></blockquote></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/dd7dfbe0-8a9e-4fe4-b37a-312c495f648f%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/dd7dfbe0-8a9e-4fe4-b37a-312c495f648f=
%40isocpp.org</a>.<br />

------=_Part_508_416094480.1489015365692--

------=_Part_507_675719803.1489015365692--

.