Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Re: RValue Arra...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 9 Topic 9809 of 9909
Post > Topic >>

Re: RValue Arrays

by Maxim Yegorushkin <maxim.yegorushkin@[EMAIL PROTECTED] > Jul 21, 2008 at 04:16 PM

On Jul 21, 12:24 pm, David Abrahams <d...@[EMAIL PROTECTED]
> wrote:
> on Sun Jul 20 2008, rkldabs-AT-gmail.com wrote:
>
> > I was not sure about what is an rvalue array and hence a little
> > googling threw up the following site
"http://209.85.175.104/search?q=cache:r1-djlzAyBUJ:www.open-std.org/jt..."
>
> > I would like to know a little more about RValue Arrays. The standard
> > as far as I have understood does not clearly explain RValue arrays.
>
> I think the only thing that makes array rvalues different from other
> rvalues is that they never exist except as a subobject of some other
> rvalue.  For example:
>
>           struct X
>           {
>               int a[20];
>           };
>
> Now
>          X()
>
> is an rvalue of type X and
>
>          X().a
>
> would be an rvalue array... if I'm not mistaken, that is ;-)

This is quite interesting. Normally:

    X makeX();
    X& x = makeX();

Generates an error because a reference to non-const can not be bound
to r-value. On the other hand:

    int(&ra)[20] = makeX().a;

Does not generate an error. In other words, the compiler does not
treat a member of an r-value as an r-value.

I wonder if r-value arrays exist.

Max


-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 9 Posts in Topic:
RValue Arrays
rkldabs@[EMAIL PROTECTED]  2008-07-20 18:33:40 
Re: RValue Arrays
David Abrahams <dave@[  2008-07-21 05:24:08 
Re: RValue Arrays
Oncaphillis <oncaphill  2008-07-21 14:41:13 
Re: RValue Arrays
Maxim Yegorushkin <max  2008-07-21 16:16:33 
Re: RValue Arrays
Gabriel Dos Reis <gdr@  2008-07-21 18:10:45 
Re: RValue Arrays
"Ivan A. Kosarev&quo  2008-07-23 07:28:14 
Re: RValue Arrays
"Ivan A. Kosarev&quo  2008-07-23 19:23:21 
Re: RValue Arrays
Gabriel Dos Reis <gdr@  2008-07-23 23:47:55 
Re: RValue Arrays
James Hopkin <tasjaeva  2008-07-24 13:29:41 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Aug 20 4:04:51 CDT 2008.