220 27871 <CAFmGaCoxuJ9LwinSRe3fV=WGwNmHOFNeyqsxajSicFzzsG_ogg@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Shahms King <shahms.king@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: pointer that propagates it's modifiers to the value
Date: Mon, 22 Aug 2016 18:11:34 +0000
Lines: 118
Approved: news@gmane.org
Message-ID: <CAFmGaCoxuJ9LwinSRe3fV=WGwNmHOFNeyqsxajSicFzzsG_ogg@mail.gmail.com>
References: <28cf9d88-64c9-47c4-83f9-46843d869150@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a1140a1b410c1cb053aacfb18
X-Trace: blaine.gmane.org 1471889511 17455 195.159.176.226 (22 Aug 2016 18:11:51 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 22 Aug 2016 18:11:51 +0000 (UTC)
To: "ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBC7ML3M6QIDBBYMA5W6QKGQENSU7JWY@isocpp.org Mon Aug 22 20:11:46 2016
Return-path: <std-proposals+bncBC7ML3M6QIDBBYMA5W6QKGQENSU7JWY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yb0-f197.google.com ([209.85.213.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC7ML3M6QIDBBYMA5W6QKGQENSU7JWY@isocpp.org>)
	id 1bbthJ-000491-FK
	for gclcip-std-proposals@m.gmane.org; Mon, 22 Aug 2016 20:11:45 +0200
Original-Received: by mail-yb0-f197.google.com with SMTP id g67sf258534731ybi.0
        for <gclcip-std-proposals@m.gmane.org>; Mon, 22 Aug 2016 11:11:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:references:in-reply-to:from:date:message-id:subject:to
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=1oxqjL6DBhc1DzoSvZ73uuFMDPCb9hv7UPUji+LF9O0=;
        b=i6LweHpyis9OpXh5YWpDqQLngef3hbTaZgTd8z2+ZcYkhwRg2IZjSxTqeA5/rqvVYl
         1MrqyX26JAjncbBMOniuEy11VJs3pYEZNzXLXNS1Mn0qeoCiNsSuWllT5eJNp1DToBYW
         u1zV995dP3Zj842zaTZuj+3CnSrrhTUZIKT5koT3hqVMmIsPFNm3UUlLXz5fjXxzgkWZ
         pBz9XWGg7ptIgUXfsD6A21DWMB1IH4wSPDYXcaxsge4zNoBP33dqiToe6jqEkOg+DkLJ
         p4L8iBSui4R96Wy61YbaUIh6SrO7kRK4uqSmsvptxUihaT5AmxnZXK9XyPrQcHJEao1t
         SXuw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:references:in-reply-to:from:date
         :message-id:subject:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=1oxqjL6DBhc1DzoSvZ73uuFMDPCb9hv7UPUji+LF9O0=;
        b=lrP2zXpBS/ZD10Jl830SzfJBCfs+b4ro7/YNlZaHg76LvuCojnuz2FhVZsRkgERnBP
         hP9jvse4FGMQbxFtqerNDhgR78WiAU9cdqAg6BUvz4oAWbi63lXWLjp+mag32GhtcZon
         bQSXa03JRdBcHKBZrtC/Ee6TPGlOIL+nmVVS3W72Z8jVFOp3j9998tj6qZV9FqhEyCFS
         Lo8ZolJ/ZQt7c0ChBbbmWOsZtaTQHzjxUwWw1Bt0Bq5eySpdlOyARyPGjSJIw9sOSlb1
         vTJkORCnX3clqIpLiipOCAkIXYXWnsgDAwZneyDA0ADmSLbtVIGE8Cj21VnaemHnySAa
         8v9Q==
X-Gm-Message-State: AEkoouspoOwKUnZR0CfQQeZOCUBe9RzFjYR+mGn4TGD7mh+10YXJMJDv8i97w9jWEfOV/g==
X-Received: by 10.36.228.140 with SMTP id o134mr15392811ith.1.1471889505764;
        Mon, 22 Aug 2016 11:11:45 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.138.146 with SMTP id c18ls4200301ioj.10.gmail; Mon, 22 Aug
 2016 11:11:44 -0700 (PDT)
X-Received: by 10.36.200.131 with SMTP id w125mr22917199itf.33.1471889504892;
        Mon, 22 Aug 2016 11:11:44 -0700 (PDT)
Original-Received: from mail-it0-x22c.google.com (mail-it0-x22c.google.com. [2607:f8b0:4001:c0b::22c])
        by mx.google.com with ESMTPS id p137si17898732itb.29.2016.08.22.11.11.44
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Mon, 22 Aug 2016 11:11:44 -0700 (PDT)
Received-SPF: pass (google.com: domain of shahms.king@gmail.com designates 2607:f8b0:4001:c0b::22c as permitted sender) client-ip=2607:f8b0:4001:c0b::22c;
Original-Received: by mail-it0-x22c.google.com with SMTP id e63so101343043ith.1
        for <std-proposals@isocpp.org>; Mon, 22 Aug 2016 11:11:44 -0700 (PDT)
X-Received: by 10.107.162.16 with SMTP id l16mr28197800ioe.106.1471889504511;
 Mon, 22 Aug 2016 11:11:44 -0700 (PDT)
In-Reply-To: <28cf9d88-64c9-47c4-83f9-46843d869150@isocpp.org>
X-Original-Sender: shahms.king@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of
 shahms.king@gmail.com designates 2607:f8b0:4001:c0b::22c as permitted sender)
 smtp.mailfrom=shahms.king@gmail.com;       dmarc=pass (p=NONE dis=NONE) header.from=gmail.com
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: <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:27871
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/27871>

--001a1140a1b410c1cb053aacfb18
Content-Type: text/plain; charset=UTF-8

http://en.cppreference.com/w/cpp/experimental/propagate_const

--Shahms

On Mon, Aug 22, 2016 at 10:54 AM Alexey Mamontov <caracrist@gmail.com>
wrote:

> The idea is simple. I need to have some member by pointer (using the
> abstract base class, for example), but I want it to behave absolutely the
> same as member by value - it must inherit the constantness of this.
>
> Lets call it member_ptr<T> and see what I mean:
>
> T * member_ptr<T>::operator->();
> const T * member_ptr<T>::operator->() const;
>
> T & member_ptr<T>::operator*();
> const T & member_ptr<T>::operator*() const;
>
> struct B
> {
>  void f() = 0;
>  void f() const = 0;
> };
> struct S
> {
>  member_ptr<B> m;
> };
>
> S s;
> s.m->f(); // void f() is called
> const S cs;
> cs.m->f(); // void f() const is called
>
> All other modifiers (volatile, rvalue) must be forwarded as well...
>
> --
> 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/28cf9d88-64c9-47c4-83f9-46843d869150%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/28cf9d88-64c9-47c4-83f9-46843d869150%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAFmGaCoxuJ9LwinSRe3fV%3DWGwNmHOFNeyqsxajSicFzzsG_ogg%40mail.gmail.com.

--001a1140a1b410c1cb053aacfb18
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><a href=3D"http://en.cppreference.com/w/cpp/experimental/p=
ropagate_const">http://en.cppreference.com/w/cpp/experimental/propagate_con=
st</a><br><div><br></div><div>--Shahms</div></div><br><div class=3D"gmail_q=
uote"><div dir=3D"ltr">On Mon, Aug 22, 2016 at 10:54 AM Alexey Mamontov &lt=
;<a href=3D"mailto:caracrist@gmail.com">caracrist@gmail.com</a>&gt; wrote:<=
br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;borde=
r-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>The idea is s=
imple.=C2=A0I need to have some member by pointer (using the abstract base =
class, for example), but I want it to behave absolutely the same as member =
by value - it must inherit the constantness of this.</div><div><br></div><d=
iv>Lets call it member_ptr&lt;T&gt; and see what I mean:</div><div><div><br=
></div><div>T *=C2=A0member_ptr&lt;T&gt;::operator-&gt;();</div><div>const =
T * member_ptr&lt;T&gt;::operator-&gt;() const;<div><br></div><div>T &amp; =
member_ptr&lt;T&gt;::operator*();</div><div>const T=C2=A0&amp; member_ptr&l=
t;T&gt;::operator*() const;</div><div><br></div><div>struct B</div><div>{</=
div><div>=C2=A0void f() =3D 0;</div><div>=C2=A0void f() const =3D 0;</div><=
div>};</div><div>struct S</div><div>{</div><div>=C2=A0member_ptr&lt;B&gt; m=
;</div><div>};</div><div><br></div><div>S s;</div><div>s.m-&gt;f(); // void=
 f() is called<div>const S cs;</div><div>cs.m-&gt;f(); // void f() const is=
 called</div><div><br></div><div>All other modifiers (volatile, rvalue) mus=
t be=C2=A0forwarded as well...=C2=A0</div></div></div></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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">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/28cf9d88-64c9-47c4-83f9-46843d869150%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/28cf9d88-64c9-=
47c4-83f9-46843d869150%40isocpp.org</a>.<br>
</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/CAFmGaCoxuJ9LwinSRe3fV%3DWGwNmHOFNeyq=
sxajSicFzzsG_ogg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFmGaCoxuJ9Lwi=
nSRe3fV%3DWGwNmHOFNeyqsxajSicFzzsG_ogg%40mail.gmail.com</a>.<br />

--001a1140a1b410c1cb053aacfb18--

.
