Topic: Tuple for subchar elements
Author: "dgutson ." <danielgutson@gmail.com>
Date: Sat, 21 Nov 2015 14:56:31 -0300
Raw View
--001a1140a73a4effa2052510b669
Content-Type: text/plain; charset=UTF-8
I've been thinking in this for a while as a possible replacement of
bitfields, superior in terms of being more C++like (constructors,
inheritance, iteration) and also the ability to specify bit order.
Wat I came out so far is a special compact tuple for containing elements of
size in terms of bits.
Let's call it momentarily std::bit_tuple, and it can contain (for now) the
following elements:
Std::bit, std::signed_integer<n>, std::unsigned_integer<n>,
std::enumerator<E, n>.
This bit_tuple would have a similar interface to std::tuple(get, tie,
initialization, etc), with the addition of a size() method that returns the
number of bits (so sizeof(bit_tuple) >= bit_tuple.size()/8).
Example:
bit_tuple<bit, bit, unsigned_integer<3>> bt;
static_assert(bt.size() == 5);
I omitted the byte order specificatipn for now.
Ideas?
Daniel.
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
--001a1140a73a4effa2052510b669
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<p dir=3D"ltr">I've been thinking in this for a while as a possible rep=
lacement of bitfields, superior in terms of being more C++like (constructor=
s, inheritance, iteration) and also the ability to specify bit order.<br>
Wat I came out so far is a special compact tuple for containing elements of=
size in terms of bits.<br>
Let's call it momentarily std::bit_tuple, and it can contain (for now) =
the following elements:<br>
=C2=A0=C2=A0=C2=A0 Std::bit, std::signed_integer<n>, std::unsigned_in=
teger<n>, std::enumerator<E, n>.</p>
<p dir=3D"ltr">This bit_tuple would have a similar interface to std::tuple(=
get, tie, initialization, etc), with the addition of a size() method that r=
eturns the number of bits (so sizeof(bit_tuple) >=3D bit_tuple.size()/8)=
..</p>
<p dir=3D"ltr">Example:</p>
<p dir=3D"ltr">bit_tuple<bit, bit, unsigned_integer<3>> bt;<br>
static_assert(bt.size() =3D=3D 5);</p>
<p dir=3D"ltr">I omitted the byte order specificatipn for now.</p>
<p dir=3D"ltr">Ideas?</p>
<p dir=3D"ltr">=C2=A0=C2=A0 Daniel.</p>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--001a1140a73a4effa2052510b669--
.
Author: "dgutson ." <danielgutson@gmail.com>
Date: Sat, 21 Nov 2015 16:28:18 -0300
Raw View
--001a1140a73a95edc7052511fe2e
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
El 21/11/2015 14:56, "dgutson ." <danielgutson@gmail.com> escribi=C3=B3:
>
> I've been thinking in this for a while as a possible replacement of
bitfields, superior in terms of being more C++like (constructors,
inheritance, iteration) and also the ability to specify bit order.
> Wat I came out so far is a special compact tuple for containing elements
of size in terms of bits.
> Let's call it momentarily std::bit_tuple, and it can contain (for now)
the following elements:
> Std::bit, std::signed_integer<n>, std::unsigned_integer<n>,
std::enumerator<E, n>.
Just realized: another interesting type could be a bit_tuple too, allowing
multidimensional bit elements.
>
> This bit_tuple would have a similar interface to std::tuple(get, tie,
initialization, etc), with the addition of a size() method that returns the
number of bits (so sizeof(bit_tuple) >=3D bit_tuple.size()/8).
>
> Example:
>
> bit_tuple<bit, bit, unsigned_integer<3>> bt;
> static_assert(bt.size() =3D=3D 5);
>
> I omitted the byte order specificatipn for now.
>
> Ideas?
>
> Daniel.
--=20
---=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
--001a1140a73a95edc7052511fe2e
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<p dir=3D"ltr"><br>
El 21/11/2015 14:56, "dgutson ." <<a href=3D"mailto:danielguts=
on@gmail.com">danielgutson@gmail.com</a>> escribi=C3=B3:<br>
><br>
> I've been thinking in this for a while as a possible replacement o=
f bitfields, superior in terms of being more C++like (constructors, inherit=
ance, iteration) and also the ability to specify bit order.<br>
> Wat I came out so far is a special compact tuple for containing elemen=
ts of size in terms of bits.<br>
> Let's call it momentarily std::bit_tuple, and it can contain (for =
now) the following elements:<br>
> =C2=A0=C2=A0=C2=A0 Std::bit, std::signed_integer<n>, std::unsign=
ed_integer<n>, std::enumerator<E, n>.</p>
<p dir=3D"ltr">Just realized: another interesting type could be a bit_tuple=
too, allowing multidimensional bit elements.</p>
<p dir=3D"ltr">><br>
> This bit_tuple would have a similar interface to std::tuple(get, tie, =
initialization, etc), with the addition of a size() method that returns the=
number of bits (so sizeof(bit_tuple) >=3D bit_tuple.size()/8).<br>
><br>
> Example:<br>
><br>
> bit_tuple<bit, bit, unsigned_integer<3>> bt;<br>
> static_assert(bt.size() =3D=3D 5);<br>
><br>
> I omitted the byte order specificatipn for now.<br>
><br>
> Ideas?<br>
><br>
> =C2=A0=C2=A0 Daniel.</p>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--001a1140a73a95edc7052511fe2e--
.