220 26527 <222b413d-87f4-4ad6-99a3-9090e5f03289@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: "'Walt Karas' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Proposing: a library header providing a flexible,
 portable, performant structure bit field facility
Date: Sat, 2 Jul 2016 08:54:58 -0700 (PDT)
Lines: 126
Approved: news@gmane.org
Message-ID: <222b413d-87f4-4ad6-99a3-9090e5f03289@isocpp.org>
References: <7d635ed8-e567-4515-b51b-137e46b2b203@isocpp.org>
 <43fedeb4-bd0c-4ea9-9d34-13e4325c86fa@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_288_182376300.1467474898745"
X-Trace: ger.gmane.org 1467474902 27584 80.91.229.3 (2 Jul 2016 15:55:02 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 2 Jul 2016 15:55:02 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDFLZXWOVYIBBU6H365QKGQEEX2T5AA@isocpp.org Sat Jul 02 17:55:02 2016
Return-path: <std-proposals+bncBDFLZXWOVYIBBU6H365QKGQEEX2T5AA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ob0-f200.google.com ([209.85.214.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDFLZXWOVYIBBU6H365QKGQEEX2T5AA@isocpp.org>)
	id 1bJNG1-0006iz-Lr
	for gclcip-std-proposals@m.gmane.org; Sat, 02 Jul 2016 17:55:01 +0200
Original-Received: by mail-ob0-f200.google.com with SMTP id hx8sf292286362obb.0
        for <gclcip-std-proposals@m.gmane.org>; Sat, 02 Jul 2016 08:55:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=87xrYN/AdQTEsHKCT/4oUgabX+yV3wSNfCYqV9FE/PI=;
        b=bZitjeZwV30cUG+t/du8HbL+Uqf9sGIJ3+6eLjDjerOPzQ4cOZF+Fya8MA4oODsQT6
         gZQaSP9VigIVf7hkFNmr003hi865ZmJ9kW5SHMB94dgsQZiLZCxnDZk1iBDfVko8mrDn
         c+PyrpKVGKY5bum8HVSiGoCbpL3EZ1ntjfbcJ256C1bhdOCjgP/o/gwsfjWrvg8HkSff
         AYHkjbG9/srUKsEB0c11Q/A3X6BqMXceaG6EDLr/LpiFv8ok1BKHPCm9CWmmSdZiUq4e
         ffD63SWi2lzHKitw4g+kikUGIg9Gzd8NNTV9iVR6+XwSGYF0+ASFNeiMpkeNdsNcOdnp
         Yysg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=87xrYN/AdQTEsHKCT/4oUgabX+yV3wSNfCYqV9FE/PI=;
        b=b+NeL66ov+qmQxXJHMI88KKqUBA+Osvl03aIGeZxA2/iuZJx58GsdON/ZNDOfOWw/G
         Yg42ZDBRXJNDO02Xirl4f7934zruFLF2BNIvUaIBenLHv7nztODr5BsiYWb1opDtCsOg
         hdA3ROo/dusX/MQyYDzCNRhtp4Sok97a/K7HdHjkQb7so/iWFNterCrKHVrxYikQlHo2
         2PAmA2sQnr74n4YGA9cmkl6rUrqoD0KDR8HFKo7LD34kXJOzHKFa0zZXGqGnnfTtx6EC
         Oti2I+nhviiwEDi291Dm+IzXy46gOeApOj3XH+xeAzuqav6VpnoWgj2Vpqb1g3WsogLs
         yAuw==
X-Gm-Message-State: ALyK8tK8q49V3NVSgcVuj+xxkgLtT8Xx6Mkwtu2DnxL+PpiFI9aAQ5XLtG2Gl60pI1427g==
X-Received: by 10.157.45.227 with SMTP id g90mr21785147otb.1.1467474900678;
        Sat, 02 Jul 2016 08:55:00 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.36.227.196 with SMTP id d187ls257585ith.5.gmail; Sat, 02 Jul
 2016 08:54:59 -0700 (PDT)
X-Received: by 10.36.91.149 with SMTP id g143mr149057itb.7.1467474899659;
        Sat, 02 Jul 2016 08:54:59 -0700 (PDT)
In-Reply-To: <43fedeb4-bd0c-4ea9-9d34-13e4325c86fa@isocpp.org>
X-Original-Sender: wkaras@yahoo.com
X-Original-From: Walt Karas <wkaras@yahoo.com>
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:26527
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/26527>

------=_Part_288_182376300.1467474898745
Content-Type: multipart/alternative; 
	boundary="----=_Part_289_1396058179.1467474898745"

------=_Part_289_1396058179.1467474898745
Content-Type: text/plain; charset=UTF-8

On Friday, July 1, 2016 at 11:46:00 PM UTC-4, Walt Karas wrote:
>
>
>
> On Friday, July 1, 2016 at 10:57:35 AM UTC-4, Walt Karas wrote:
>>
>> This prototype could be used as a starting point:
>>
>> https://github.com/wkaras/C-plus-plus-library-bit-fields
>>
>> I think the use of macros and reinterpret_cast could be eliminated with 
>> some tweaks to member pointers in the base language:
>>
>> o  Allow static_cast<size_t>(mp) where mp is a pointer to a data member 
>> of a Standard Layout Class.
>>
>> o  Eliminate the need for boilerplate & and class name prefix when the 
>> context implies them.  So:
>>
>> int Cls::*p = &x.i;
>>
>
> Typo, replace with:
>
> int Cls::*p = &Cls::i;
>
>  
>
>>
>> could be written simply as:
>>
>> int Cls::*p = i;
>>
>> o  Allow member pointers to members of members and base classes. 
>>  Possible syntax (showing boiler plate):
>>
>> mp1 = &Cls::x.y; // member of member
>> mp2 = &Cls::Base; // base
>> mp3 = &Cls::Base::SubBase; // sub-base
>>
>
My thinking is that, with these changes, bit field structure use could look 
something like:

std::bitf<Traits, Format>::mem x;
x[u.v] = 57; // v a member of u, a member of Format, which is a bit field 
format structure

Or, with the dot operator overloading proposal, accessing a bit field could 
look the same as it currently does.

-- 
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/222b413d-87f4-4ad6-99a3-9090e5f03289%40isocpp.org.

------=_Part_289_1396058179.1467474898745
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Friday, July 1, 2016 at 11:46:00 PM UTC-4, Walt Karas w=
rote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8e=
x;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><br><br>=
On Friday, July 1, 2016 at 10:57:35 AM UTC-4, Walt Karas 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">This prototype could be used a=
s a starting point:<div><br></div><div><a href=3D"https://github.com/wkaras=
/C-plus-plus-library-bit-fields" rel=3D"nofollow" target=3D"_blank" onmouse=
down=3D"this.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgith=
ub.com%2Fwkaras%2FC-plus-plus-library-bit-fields\x26sa\x3dD\x26sntz\x3d1\x2=
6usg\x3dAFQjCNGjN1MHxlfN_ip1k-50c3-j_5nljA&#39;;return true;" onclick=3D"th=
is.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fw=
karas%2FC-plus-plus-library-bit-fields\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAF=
QjCNGjN1MHxlfN_ip1k-50c3-j_5nljA&#39;;return true;">https://github.com/wkar=
as/C-<wbr>plus-plus-library-bit-fields</a><br></div><div><br></div><div>I t=
hink the use of macros and reinterpret_cast could be eliminated with some t=
weaks to member pointers in the base language:</div><div><br></div><div>o =
=C2=A0Allow static_cast&lt;size_t&gt;(mp) where mp is a pointer to a data m=
ember of a Standard Layout Class.</div><div><br></div><div>o =C2=A0Eliminat=
e the need for boilerplate &amp; and class name prefix when the context imp=
lies them. =C2=A0So:</div><div><br></div><div>int Cls::*p =3D &amp;x.i;</di=
v></div></blockquote><div><br></div><div>Typo, replace with:</div><div><br>=
</div><div>int Cls::*p =3D &amp;Cls::i;</div><div><br></div><div>=C2=A0</di=
v><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;bor=
der-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><br></div><=
div>could be written simply as:</div><div><br></div><div>int Cls::*p =3D i;=
</div><div><br></div><div>o =C2=A0Allow member pointers to members of membe=
rs and base classes. =C2=A0Possible syntax (showing boiler plate):</div><di=
v><br></div><div>mp1 =3D &amp;Cls::x.y; // member of member</div><div>mp2 =
=3D &amp;Cls::Base; // base</div><div>mp3 =3D &amp;Cls::Base::SubBase; // s=
ub-base<br></div></div></blockquote></div></blockquote><div><br></div><div>=
My thinking is that, with these changes, bit field structure use could look=
 something like:</div><div><br></div><div>std::bitf&lt;Traits, Format&gt;::=
mem x;</div><div>x[u.v] =3D 57; // v a member of u, a member of Format, whi=
ch is a bit field format structure</div><div><br></div><div>Or, with the do=
t operator overloading proposal, accessing a bit field could look the same =
as it currently does.</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/222b413d-87f4-4ad6-99a3-9090e5f03289%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/222b413d-87f4-4ad6-99a3-9090e5f03289=
%40isocpp.org</a>.<br />

------=_Part_289_1396058179.1467474898745--

------=_Part_288_182376300.1467474898745--

.
