220 14664 <a5792d58-b1c3-4b34-a1ed-3333963822f1@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: corentin.schreiber@cea.fr
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: "const public:" and "const private:" to avoid to
 write "T Get() const" member functions
Date: Thu, 20 Nov 2014 15:17:40 -0800 (PST)
Lines: 108
Approved: news@gmane.org
Message-ID: <a5792d58-b1c3-4b34-a1ed-3333963822f1@isocpp.org>
References: <a15820e4-3c90-400d-bf49-434467d728f6@isocpp.org>	<CAFk2RUb2pRCcfVi42dhQwaVA_8LHEuBzd2ksVnjhvbmmUdntiQ@mail.gmail.com>	<CAGsORuCgwLBJthMHtRqmqvn8_xV_3TqH6x_XL=SFxppFFb+r_A@mail.gmail.com> <CAOfiQqnau89HHwe3euHkgKrewYemY8r4SG6axCtGEwLOkXbw7A@mail.gmail.com>
 <m4lrhn$r6l$1@ger.gmane.org>
 <b17237cf-69aa-4c1e-9c61-349227271ca9@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_6905_1201651892.1416525460885"
X-Trace: ger.gmane.org 1416525470 32326 80.91.229.3 (20 Nov 2014 23:17:50 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 20 Nov 2014 23:17:50 +0000 (UTC)
Cc: mw_triad@users.sourceforge.net, corentin.schreiber@cea.fr
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCX4RQEPQAMBBFPNXGRQKGQEDNBX5QQ@isocpp.org Fri Nov 21 00:17:43 2014
Return-path: <std-proposals+bncBCX4RQEPQAMBBFPNXGRQKGQEDNBX5QQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pa0-f69.google.com ([209.85.220.69])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCX4RQEPQAMBBFPNXGRQKGQEDNBX5QQ@isocpp.org>)
	id 1Xrays-0003cU-QA
	for gclcip-std-proposals@m.gmane.org; Fri, 21 Nov 2014 00:17:43 +0100
Original-Received: by mail-pa0-f69.google.com with SMTP id et14sf19061781pad.8
        for <gclcip-std-proposals@m.gmane.org>; Thu, 20 Nov 2014 15:17:42 -0800 (PST)
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:cc:message-id:in-reply-to
         :references:subject:mime-version:content-type:x-original-sender
         :reply-to:precedence:mailing-list:list-id:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=wWI3HvzD5CgSlmqbHPXq7/pgTPfTYRNDJTcwIyo9CAk=;
        b=FHPuTCssxI3uQkUOriOeuG2HeOuu0Ncjw5vriVERTzjhrBPyNo8DcGi5BKlwKoeifu
         mdz9E+59WpIiDnL+5vtU+7ZTcrEio0IAKyYC/Qcnl4iRtm96/nyCWuYlyUSqi9c3DrHa
         kS4vP3kTRlxvwFJ8pNbPi6k1ikTwZbGA9l6ABidgfK18QCiXbKxdQ6WizhWQw5AHsInC
         26Lc5foMSSUei1JrhW3JUPdswJvonIN2V8zz437nKREbsf/mt0TegQRpnRvepM2/FEsh
         igJ4ar3J7Le7gSAhGtnByHscdxmIebgk1Xj0Os941pIBzPTW+QxQLvRaddxe5DH9wvIn
         BuNA==
X-Gm-Message-State: ALoCoQnCkC73uC0QwlIGB1kGLtjtsZo/ojsRgc2z3paVG78ZvHcX6P7DmIolJX9Bff7QbBpAvKcH
X-Received: by 10.66.124.132 with SMTP id mi4mr1137869pab.30.1416525462080;
        Thu, 20 Nov 2014 15:17:42 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.88.243 with SMTP id t106ls498552qgd.88.gmail; Thu, 20 Nov
 2014 15:17:41 -0800 (PST)
X-Received: by 10.140.40.20 with SMTP id w20mr15450qgw.2.1416525461304;
        Thu, 20 Nov 2014 15:17:41 -0800 (PST)
In-Reply-To: <b17237cf-69aa-4c1e-9c61-349227271ca9@isocpp.org>
X-Original-Sender: corentin.schreiber@cea.fr
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://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>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:14664
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/14664>

------=_Part_6905_1201651892.1416525460885
Content-Type: multipart/alternative; 
	boundary="----=_Part_6906_2129725851.1416525460891"

------=_Part_6906_2129725851.1416525460891
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Le vendredi 21 novembre 2014 00:15:54 UTC+1, corentin....@cea.fr a =C3=A9cr=
it :
>
> Le jeudi 20 novembre 2014 23:56:12 UTC+1, Matthew Woehlke a =C3=A9crit :
>>
>> On 2014-11-20 17:36, Richard Smith wrote:=20
>> > A variant of the 'inline variables and encapsulated expressions'=20
>> proposal=20
>> > would allow this:=20
>> >=20
>> > class X {=20
>> >   int private_x;=20
>> > public:=20
>> >   using public_x =3D +private_x;=20
>> > };=20
>> > X x;=20
>> > int a =3D x.public_x; // ok, means the same thing as 'int a =3D=20
>> +x.private_x;'=20
>> > but access check is done inside X.=20
>>
>> How would you achieve this for a member of, say, a container type? (In=
=20
>> my specific case, I have something like std::vector<Bar>...)=20
>>
>> --=20
>> Matthew=20
>>
>>
> using public_x =3D static_cast<const decltype(x)&>(private_x); ?=20
>

Sorry, typing too fast:
using public_x =3D const_cast<const decltype(private_x)&>(private_x); ? =20

--=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/.

------=_Part_6906_2129725851.1416525460891
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Le vendredi 21 novembre 2014 00:15:54 UTC+1, corentin....@=
cea.fr a =C3=A9crit&nbsp;:<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">Le jeudi 20 novembre 2014 23:56:12 UTC+1, Matthew Woehlke a =
=C3=A9crit&nbsp;:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin=
-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">On 2014-11-20 17:3=
6, Richard Smith wrote:
<br>&gt; A variant of the 'inline variables and encapsulated expressions' p=
roposal
<br>&gt; would allow this:
<br>&gt;=20
<br>&gt; class X {
<br>&gt; &nbsp; int private_x;
<br>&gt; public:
<br>&gt; &nbsp; using public_x =3D +private_x;
<br>&gt; };
<br>&gt; X x;
<br>&gt; int a =3D x.public_x; // ok, means the same thing as 'int a =3D +x=
..private_x;'
<br>&gt; but access check is done inside X.
<br>
<br>How would you achieve this for a member of, say, a container type? (In
<br>my specific case, I have something like std::vector&lt;Bar&gt;...)
<br>
<br>--=20
<br>Matthew
<br>
<br></blockquote><div><br>using public_x =3D static_cast&lt;const decltype(=
x)&amp;&gt;(private_x); ? <br></div></div></blockquote><div><br>Sorry, typi=
ng too fast:<br>using public_x =3D const_cast&lt;const decltype(private_x)&=
amp;&gt;(private_x); ?&nbsp; <br></div></div>

<p></p>

-- <br />
<br />
--- <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 />
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 />

------=_Part_6906_2129725851.1416525460891--
------=_Part_6905_1201651892.1416525460885--

.
