Re: A non-const reference may only be bound to an lvalue?
- From: "Igor Tandetnik" <itandetnik@xxxxxxxx>
- Date: Fri, 14 Dec 2007 08:12:30 -0500
"George" <George@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7790CF47-E70E-4079-A7C9-6F2C2FF528D8@xxxxxxxxxxxxx
Why,
That returned instance of B is not an lvalue - it's a temporary
rvalue.?
I think lvalue is something we can address and rvalue is something we
can not address. The reurn instance of B is a temporary object, I
think an object is addressable and should be lvalue?
No, it's not "addressable" and it's not an lvalue. Specifically, this
doesn't compile:
B* p = &( source() );
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
.
- Follow-Ups:
- References:
- Re: A non-const reference may only be bound to an lvalue?
- From: Carl Daniel [VC++ MVP]
- Re: A non-const reference may only be bound to an lvalue?
- From: George
- Re: A non-const reference may only be bound to an lvalue?
- Prev by Date: Re: Reversing a String
- Next by Date: Re: A non-const reference may only be bound to an lvalue?
- Previous by thread: Re: A non-const reference may only be bound to an lvalue?
- Next by thread: Re: A non-const reference may only be bound to an lvalue?
- Index(es):
Relevant Pages
|