220 12732 <2285060d-e475-48f8-a9cc-389487ee681f@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Matthew Fioravante <fmatthew5876@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Usability extensions to offsetof
Date: Mon, 8 Sep 2014 11:05:31 -0700 (PDT)
Lines: 90
Approved: news@gmane.org
Message-ID: <2285060d-e475-48f8-a9cc-389487ee681f@isocpp.org>
References: <fc4c748a-1805-4e92-ae3f-58bbfe6b7537@isocpp.org>
 <1790122.GP859xiMW3@tjmaciei-mobl4>
 <dedaddc6-c382-4256-83a9-6af4dbd91caf@isocpp.org>
 <3079502.NAEi170Di4@tjmaciei-mobl4>
 <c11dc8b4-df55-4530-9322-b6bd5de9ce54@isocpp.org>
 <07066304-6357-4a10-824b-7c0451608996@isocpp.org>
 <CAOfiQq=pVvepG1ciqtxhHpa_FTqJGyimbyZ+9ihWZmJCT0oRCA@mail.gmail.com>
 <CAOfiQqmK6Zq=Yb7auaNFjrwCR=HkTc6bYVcV54z26mz5FxPKTQ@mail.gmail.com>
 <13fd60e5-2882-48bc-a9df-3c8d38b416eb@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_556_866220740.1410199531900"
X-Trace: ger.gmane.org 1410199541 13835 80.91.229.3 (8 Sep 2014 18:05:41 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 8 Sep 2014 18:05:41 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDELF54RTIGRB3G7W6QAKGQEDQPMR3A@isocpp.org Mon Sep 08 20:05:35 2014
Return-path: <std-proposals+bncBDELF54RTIGRB3G7W6QAKGQEDQPMR3A@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yh0-f69.google.com ([209.85.213.69])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDELF54RTIGRB3G7W6QAKGQEDQPMR3A@isocpp.org>)
	id 1XR3Jm-000402-B7
	for gclcip-std-proposals@m.gmane.org; Mon, 08 Sep 2014 20:05:34 +0200
Original-Received: by mail-yh0-f69.google.com with SMTP id a41sf16159912yho.4
        for <gclcip-std-proposals@m.gmane.org>; Mon, 08 Sep 2014 11:05:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe
         :content-type;
        bh=j8q+GysHtIptxl1zdTRRSIJkD251WCVhcPBoJLNYuGo=;
        b=pG8lhigLVrUUIaC9Xd6Dm38RLq9H1HFuAMqD/pEQ66/vuXYHXcs0vwkqKtOgcd1hQ/
         UqTap7r5q3b3NadZMDxJIgofJVoNwBBpOy8FqEirlZJnQ5xAN0M6ngRw84Lb/YwodE1j
         uvD8DCIt+lL7bGBl4KdI8tTjt7qZpnI03iPXxgr5blu3RsL/atmOSUiZ/+d/YFDHVbyL
         diKUhZmCeqvuiBBuQERZCPLMJ7/osCPQcdMQNyK68bTmqds62sDyx9eavmUkhq0AdaJI
         2FPPcWBTp/pxjxz21LhFinKgRz6Xm8o6Db98CJyVXHyKxp+u4EN+ja0lwcyxOE7WDOhC
         EVbw==
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:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe:content-type;
        bh=j8q+GysHtIptxl1zdTRRSIJkD251WCVhcPBoJLNYuGo=;
        b=RhbNZ4zjW0mgaWnlnLQc9K0QTCkxeJtcwO8C4VCTJuJ3omHJpG3+A1TNx8G5BvuppL
         i8aVMT36MRTaB/OZ6AO/Qnz1Yk8rU6v+KcfiVrt25v6H/hqoAj0hdeitIkN3z8yL9dn8
         5X3hP/9OmdhnQz4J+B/8WpAuEhd3uwAepy7MoFITZQdVWinI7hKKI7dmHcaxaM78jwhH
         c3I5x4MkPkm+9/h4QDTQy6oWiah1Lc41zkkxN5yi0JHk6MB8W5M65wVe2Yndac+IHH7Y
         UiOq+gNyoaslsfLdwtNm/8TsXPJXuJ+REHYbu08Zo2c59F1fQv8U6GL59ueXOd2Iel1D
         Xc+Q==
X-Gm-Message-State: ALoCoQmyw3+hDL/IHDMy6gYU3ZOXXHUixbLJQxcdTD2cild3Z9wuKVOZ4HBDFc99OjdmI5wMmhSX
X-Received: by 10.236.230.106 with SMTP id i100mr18190838yhq.27.1410199533295;
        Mon, 08 Sep 2014 11:05:33 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.91.164 with SMTP id z33ls320886qgd.99.gmail; Mon, 08 Sep
 2014 11:05:32 -0700 (PDT)
X-Received: by 10.140.33.161 with SMTP id j30mr692361qgj.4.1410199532602;
        Mon, 08 Sep 2014 11:05:32 -0700 (PDT)
In-Reply-To: <13fd60e5-2882-48bc-a9df-3c8d38b416eb@isocpp.org>
X-Original-Sender: fmatthew5876@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: <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:12732
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/12732>

------=_Part_556_866220740.1410199531900
Content-Type: text/plain; charset=UTF-8



On Sunday, September 7, 2014 6:57:26 PM UTC-4, Bengt Gustafsson wrote:
>
> Inner classes: If the only instance of the inner class is by value in its 
> outer class then we could accomplish accessing the outer class's members 
> without any coding:
>
> class Outer {
>     int x;
>
>     class Inner {
>         void f() {
>             int y = x; // This is assigning from Outer's x.
>         }
>     } m_inner;
> };
>
>
I think this should require some extra syntax to enforce that Inner is only 
allowed to be instantiated in one place and only as a value data member of 
Outer.

Something like:

class Outer {
  int x;
  static class Inner {
    void f() { int y = x; }
  } _inner1; //<-OK
  Inner _inner2; //<- ERROR: cannot create multiple instances of a static 
nested class
  static class AnotherInner {}; //<-ERROR: cannot define a static nested 
class without also instantiating a value data member
}; 


-- 

--- 
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/.

------=_Part_556_866220740.1410199531900
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Sunday, September 7, 2014 6:57:26 PM UTC-4, Ben=
gt Gustafsson wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;ma=
rgin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr">Inner classes: If the only instance of the inner class is by value=
 in its outer class then we could accomplish accessing the outer class's me=
mbers without any coding:<div><br></div><div>class Outer {</div><div>&nbsp;=
 &nbsp; int x;</div><div><br></div><div>&nbsp; &nbsp; class Inner {</div><d=
iv>&nbsp; &nbsp; &nbsp; &nbsp; void f() {</div><div>&nbsp; &nbsp; &nbsp; &n=
bsp; &nbsp; &nbsp; int y =3D x; // This is assigning from Outer's x.</div><=
div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; } m_inner;</div><=
div><div>};</div><br></div></div></blockquote><div><br>I think this should =
require some extra syntax to enforce that Inner is only allowed to be insta=
ntiated in one place and only as a value data member of Outer.<br><br>Somet=
hing like:<br><br>class Outer {<br>&nbsp; int x;<br>&nbsp; static class Inn=
er {<br>&nbsp; &nbsp; void f() { int y =3D x; }<br>&nbsp; } _inner1; //&lt;=
-OK<br>&nbsp; Inner _inner2; //&lt;- ERROR: cannot create multiple instance=
s of a static nested class<br>&nbsp; static class AnotherInner {}; //&lt;-E=
RROR: cannot define a static nested class without also instantiating a valu=
e data member<br>}; <br><br><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_556_866220740.1410199531900--

.
