[cfe-commits] [libcxx] r124192 - /libcxx/trunk/include/tuple

Howard Hinnant hhinnant at apple.com
Tue Jan 25 08:50:21 PST 2011


On Jan 25, 2011, at 11:43 AM, Douglas Gregor wrote:

> 
> On Jan 25, 2011, at 8:31 AM, Howard Hinnant wrote:
> 
>> Author: hhinnant
>> Date: Tue Jan 25 10:31:30 2011
>> New Revision: 124192
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=124192&view=rev
>> Log:
>> tweak for readability (no functionality change)
>> 
>> Modified:
>>    libcxx/trunk/include/tuple
>> 
>> Modified: libcxx/trunk/include/tuple
>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/tuple?rev=124192&r1=124191&r2=124192&view=diff
>> ==============================================================================
>> --- libcxx/trunk/include/tuple (original)
>> +++ libcxx/trunk/include/tuple Tue Jan 25 10:31:30 2011
>> @@ -589,7 +589,7 @@
>> get(tuple<_Tp...>&& __t)
>> {
>>     typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
>> -    return static_cast<typename tuple_element<_Ip, tuple<_Tp...> >::type&&>(
>> +    return static_cast<type&&>(
>>              static_cast<__tuple_leaf<_Ip, type>&&>(__t.base_).get());
>> }
> 
> Oh, I forgot to mention… an alternative implementation approach would be to add more __tuple_leaf::get() overloads that use ref-qualifiers to distinguish between __tuple_leaf-as-lvalue and __tuple_leaf-as-rvalue. However, Clang doesn't support ref-qualifiers yet, so I went this route.

<nod>  Yeah, I don't implement anything I can't test.  And that's the reason you're hitting all the "rvalue reference cannot bind to an lvalue" bugs.  clang is the first compiler to be used here supporting the new rules.  I'm sure there's going to be more.  And looking forward to the updated rvalue-ref support! :-)

-Howard





More information about the cfe-commits mailing list