Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion status of rvalue reference proposal (n1377, n1770, et al)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Howard Hinnant  
View profile  
 More options Jul 18 2005, 12:54 pm
Newsgroups: comp.std.c++
From: Howard Hinnant <hinn...@metrowerks.com>
Date: Mon, 18 Jul 2005 10:54:11 CST
Local: Mon, Jul 18 2005 12:54 pm
Subject: Re: status of rvalue reference proposal (n1377, n1770, et al)
In article <1121517407.194853.244...@g14g2000cwa.googlegroups.com>,
 "Russell Yanofsky" <russell.yanof...@us.army.mil> wrote:

> Thanks for the detailed replies. That was exactly the kind of
> information I was looking for.

> I've got a separate question on N1770. The proposed clause on
> expressions (5/6) reads:

>   If an expression initially has the type ``reference to T''
>   (dcl.ref, dcl.init.ref), the type is adjusted to ``T'' prior to
>   any further analysis and the expression designates the object or
>   function denoted by the reference. The expression is considered an
>   lvalue after this adjustment if the expression type was
>   ``rvalue-reference to T'' and the expression is a variable
>   reference, parameter reference, class member access operation
>   (expr.ref), or pointer-to-member operation (expr.mptr.oper), or if
>   the expression type was ``lvalue-reference to T''; otherwise, it
>   is considered an rvalue.

> What is the bit about pointer-to-member operations? I'd think there
> could never be a pointer to member operation with the type of
> ``rvalue-reference to T'' since a pointer to member can't point to a
> member with reference type (8.3.3/3).

I believe you are correct (but I could be mistaken).  The intent of 5p6
in N1770 is to implement the general notion of N1377:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1377.htm#Ret...
ng%20A&&

> Earlier this paper proposed that:

>     Named rvalue references are treated as lvalues.

> This thought will now be completed:

>     Unnamed rvalue references are treated as rvalues.

That is, if a function returns an rvalue reference:

A&& foo();

then that function result is treated as an rvalue.

bar(foo()); // foo() is treated as an rvalue when
            // selecting among the overload resolution set

But rvalue references that have an identifier attached to them, such as
a function parameter, are treated as lvalues:

void foo(A&& a)
{
    // a is an lvalue here

}

The standard has no concept of "named and unnamed references", and so
the concept was translated into currently accepted standardeeze.  It is
quite possible that a bug or two crept in during that translation.  
Thanks for bringing this possibility to our attention.

-Howard

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-...@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.