220 4338 <6477a95a-1692-4a86-bdee-4135e793a8e3@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: unituniverse.1@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: A cleaner way to define nested class/structure
Date: Wed, 8 May 2013 12:04:44 -0700 (PDT)
Lines: 201
Approved: news@gmane.org
Message-ID: <6477a95a-1692-4a86-bdee-4135e793a8e3@isocpp.org>
References: <27175469-a158-4bc1-9f30-66e3a647e931@isocpp.org>
 <102b1477-204a-4504-80eb-197e1ad97206@isocpp.org>
 <CAE1+Xsa3jwDnAYOzrVEg62HnJJMcsomq-mZLZOJsws6oU2cvJg@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_34_11309744.1368039884227"
X-Trace: ger.gmane.org 1368039894 22183 80.91.229.3 (8 May 2013 19:04:54 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 8 May 2013 19:04:54 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDBYPZVK7MJRBTWDVKGAKGQEMKG42YY@isocpp.org Wed May 08 21:04:53 2013
Return-path: <std-proposals+bncBDBYPZVK7MJRBTWDVKGAKGQEMKG42YY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oa0-f69.google.com ([209.85.219.69])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDBYPZVK7MJRBTWDVKGAKGQEMKG42YY@isocpp.org>)
	id 1Ua9fV-0003qG-0x
	for gclcip-std-proposals@m.gmane.org; Wed, 08 May 2013 21:04:49 +0200
Original-Received: by mail-oa0-f69.google.com with SMTP id i10sf9271921oag.0
        for <gclcip-std-proposals@m.gmane.org>; Wed, 08 May 2013 12:04:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=x-received:x-beenthere:x-received:date:from:to:message-id
         :in-reply-to:references:subject:mime-version:x-original-sender
         :reply-to:precedence:mailing-list:list-id:x-google-group-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe
         :content-type;
        bh=q5rlxVgM/l1PTP5PKck7ayncHgtkvvjc4VTD2UN6UnU=;
        b=JkLXXuV5CNN4CkKu+epTnWrTgzoQkT9Fx2krS8CwHk4nlv1xrCN6i5rsnIDtqdUBBX
         hm6uhrO6m7YPTX8udC6KBXO1YGc8x8aLWJnO/gno4ipwSIXk1BalmCmnLnD3JvP4i6yW
         cN/fVtZF7T8+eoWgu0ju5JcDMxatPu2Y3JCGFSn06d0i596ghC5A8dOWynhBsF3MYHII
         58gSErPXgxnpUFwsuel+oYLbixp2y7GFZ7O+baQPgw2YaIUCYtUsu6rUaN2F+lFx4jpI
         vecAvo+cQzqnlTX3ea/Cv3Dbd/8JXOm7dKhFuN6PZ+P72HsuNO7C/i0Bbt/Mh3OnFwQt
         5zrg==
X-Received: by 10.182.28.233 with SMTP id e9mr4472666obh.23.1368039887786;
        Wed, 08 May 2013 12:04:47 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.182.29.168 with SMTP id l8ls141323obh.45.gmail; Wed, 08 May
 2013 12:04:46 -0700 (PDT)
X-Received: by 10.182.80.167 with SMTP id s7mr124092obx.1.1368039886166;
        Wed, 08 May 2013 12:04:46 -0700 (PDT)
In-Reply-To: <CAE1+Xsa3jwDnAYOzrVEg62HnJJMcsomq-mZLZOJsws6oU2cvJg@mail.gmail.com>
X-Original-Sender: unituniverse1@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?hl=en>,
 <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?hl=en&topic=25838>,
 <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:4338
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/4338>

------=_Part_34_11309744.1368039884227
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



=E5=9C=A8 2013=E5=B9=B45=E6=9C=888=E6=97=A5=E6=98=9F=E6=9C=9F=E4=B8=89UTC-4=
=E4=B8=8B=E5=8D=882=E6=97=B636=E5=88=8645=E7=A7=92=EF=BC=8CHariharan Subram=
anian=E5=86=99=E9=81=93=EF=BC=9A
>
>
>
> On Wed, May 8, 2013 at 1:11 AM, <unituni...@gmail.com <javascript:>>wrote=
:
>
>> How about this:
>> template < typename _Ty1 >
>> class Outer
>> {
>>     template < typename _Ty2 > class Inner;
>> };
>>
>> // How to write Inner here?
>>
> =20
> It gives the user the capability to write the definition of inner class=
=20
> even before the outer class is defined. Only the order is reversed. If we=
=20
> can define Inner class after the Outer class we can use the same techniqu=
e=20
> to define the Inner class before defining the Outer class. So there is no=
=20
> problem here.
>
> And this:
>> class C1
>> {
>> };
>>
>> class Outer
>> {
>>   class C1;
>> };
>>
>> //class Outer::C1 {}; // Any conflict?
>>
>
> Outer::C1 is defined after defining Outer class. So this is not related t=
o=20
> this proposal. The answer for your question is there is no conflict.
>
> Regards,
> Hariharan S
>
> you still gives no answer of the first question.
i mean how to write the template's definition if the Inner will be defined=
=20
as a nested class? or just provided a rule say: a nested class/structure=20
can't be defined outside of a class if it is a template (or if the outer is=
=20
a template)? or provided another formal of expression for template-nestes?

The second scope, as i asked before, currently the following code piece is=
=20
legal:

class C1 // ::C1
{
};

class Outer
{
  class C1 // ::Outer::C1
  {
  };

  class C1; // Declaration of the ::Outer::C1 but not ::C1
};

There is no conflict here.
Now, assuming if we plan to write a inner class C1 and put its definition=
=20
out of the class, how to sure that no conflict will exist?
Like the following steps:
step1: Creating a new project, nothing but a entry functions in your=20
source, then put the code here:

class Outer
{
  class Inner;
};

class Outer::Inner
{
};
Compile. okay no problem. then, blablabla, then, including some header=20
files. but unfortunatly there is another global class named 'Inner' in=20
them(assuming the maker of the header files is insane...). Now what the=20
'class Inner;' in the definition scope of class Outer represents now?

--=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/?hl=3Den.



------=_Part_34_11309744.1368039884227
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<br><br>=E5=9C=A8 2013=E5=B9=B45=E6=9C=888=E6=97=A5=E6=98=9F=E6=9C=9F=E4=B8=
=89UTC-4=E4=B8=8B=E5=8D=882=E6=97=B636=E5=88=8645=E7=A7=92=EF=BC=8CHarihara=
n Subramanian=E5=86=99=E9=81=93=EF=BC=9A<blockquote class=3D"gmail_quote" s=
tyle=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-le=
ft: 1ex;"><div dir=3D"ltr"><div><br><br><div class=3D"gmail_quote">On Wed, =
May 8, 2013 at 1:11 AM,  <span dir=3D"ltr">&lt;<a href=3D"javascript:" targ=
et=3D"_blank" gdf-obfuscated-mailto=3D"YKspXjrINUEJ">unituni...@gmail.com</=
a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;p=
adding-left:1ex"><div>How about this:<div>template &lt; typename _Ty1 &gt;<=
/div>
<div>class Outer</div><div>{</div><div>&nbsp; &nbsp; template &lt; typename=
 _Ty2 &gt; class Inner;</div><div>};</div><div><br></div><div>// How to wri=
te Inner here?</div></div></blockquote><div>&nbsp;</div>It gives the user t=
he capability to write the definition of inner class even before the outer =
class is defined. Only the order is reversed. If we can define Inner class =
after the Outer class we can use the same technique to define the Inner cla=
ss before defining the Outer class. So there is no problem here.<div>
<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8=
ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-sty=
le:solid;padding-left:1ex"><div><div></div><div>And this:</div><div>
class C1</div><div>{</div><div>};</div><div><br></div><div>class Outer</div=
><div>{</div><div>&nbsp; class C1;</div><div>};</div><div><br></div><div>//=
class Outer::C1 {}; // Any conflict?</div></div></blockquote><div><br></div=
>
<div>Outer::C1 is defined after defining Outer class. So this is not relate=
d to this proposal. The answer for your question is there is no conflict.</=
div><div><br></div><div>Regards,</div><div>Hariharan S</div>
<div><br></div></div></div></div></blockquote><div>you still gives no answe=
r of the first question.</div><div>i mean how to write the template's defin=
ition if the Inner will be defined as a nested class? or just provided a ru=
le say: a nested class/structure can't be defined outside of a class if it =
is a template (or if the outer is a template)? or provided another formal o=
f expression for template-nestes?</div><div><br></div><div>The second scope=
, as i asked before, currently the following code piece is legal:</div><div=
><br></div><div><div><font color=3D"#000000">class C1 // ::C1</font></div><=
div><font color=3D"#000000">{</font></div><div><font color=3D"#000000">};</=
font></div><div><font color=3D"#000000"><br></font></div><div><font color=
=3D"#000000">class Outer</font></div><div><font color=3D"#000000">{</font><=
/div><div><font color=3D"#000000">&nbsp; class C1 // ::Outer::C1</font></di=
v><div><font color=3D"#000000">&nbsp; {</font></div><div><font color=3D"#00=
0000">&nbsp; };</font></div><div><font color=3D"#000000"><br></font></div><=
div><font color=3D"#000000">&nbsp; class C1; // Declaration of the&nbsp;</f=
ont><span style=3D"color: rgb(0, 0, 0);">::Outer::C1 but not ::C1</span></d=
iv><div><font color=3D"#000000">};</font></div></div><div><font color=3D"#0=
00000"><br></font></div><div><font color=3D"#000000">There is no conflict h=
ere.</font></div><div><font color=3D"#000000">Now, assuming if we plan to w=
rite a inner class C1 and put its definition out of the class, how to sure =
that no conflict will exist?</font></div><div><font color=3D"#000000">Like =
the following steps:</font></div><div><font color=3D"#000000">step1: Creati=
ng a new project, nothing but a entry functions in your source, then put th=
e code here:</font></div><div><br></div><div><div><div><font color=3D"#0000=
00">class Outer</font></div><div><font color=3D"#000000">{</font></div><div=
><font color=3D"#000000">&nbsp; class Inner;</font></div><div><font color=
=3D"#000000">};</font></div></div></div><div><font color=3D"#000000"><br></=
font></div><div><font color=3D"#000000">class Outer::Inner</font></div><div=
><font color=3D"#000000">{</font></div><div><font color=3D"#000000">};</fon=
t></div><div><font color=3D"#000000">Compile. okay no problem. then, blabla=
bla, then, including some header files. but unfortunatly there is another g=
lobal class named 'Inner' in them(assuming the maker of the header files is=
 insane...). Now what the 'class Inner;' in the definition scope of class O=
uter&nbsp;represents now?</font></div><div><font color=3D"#000000"><br></fo=
nt></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_34_11309744.1368039884227--

.
