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 6 of 9 Topic 9809 of 9984
Post > Topic >>

Re: RValue Arrays

by "Ivan A. Kosarev" <ik@[EMAIL PROTECTED] > Jul 23, 2008 at 07:28 AM

Maxim Yegorushkin wrote:
> 
> 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.

Both the initializations try to bound to a tem****ary and thus forbidden.

GCC complains about that pretty clearly. What compiler you use?

> I wonder if r-value arrays exist.

Yes, they do.

-- 

      [ 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 Sun Sep 7 8:32:14 CDT 2008.