[c++0x] tuple rework

Pedro Lamarão pedro.lamarao@mndfck.org
Sat Feb 16 00:17:00 GMT 2008


Attached is a patch to the <tuple> header.

The reason they fail is discussed in another messge I sent today.

I'm not sending this patch to gcc-patches with a Changelog entry because 
of it provokes new test case failures and because I feel I'm stepping in 
the limits of my C++0x knowledge.

This patch changes basically these things:

*) all __add_c_ref and remove_references uses were removed and replaced 
with simple const& and && variations;
*) all tuple constructors taking a tuple argument convert the argument 
explicitly to it's corresponding _Tuple_base in order to pick the 
correct base constructor;
*) all template constructors taking a tuple&& argument std::forward the 
tuple elements instead of std::move'ing them when initializing the 
contained element.

I believe the remove_reference and __add_c_ref machinery was put in 
place to deal with the case where the tuple element type is a T& .
Properly std::forward'ing elements in initialization solves this difficulty.

This patch makes the attached test case PASS.
Four other tests FAIL, on the other hand.

FAIL: 20_util/tuple/comparison_operators/comparisons.cc (test for excess 
errors)
WARNING: 20_util/tuple/comparison_operators/comparisons.cc compilation 
failed to produce executable
FAIL: 20_util/tuple/cons/assignment.cc (test for excess errors)
WARNING: 20_util/tuple/cons/assignment.cc compilation failed to produce 
executable
FAIL: 20_util/tuple/cons/big_tuples.cc (test for excess errors)
WARNING: 20_util/tuple/cons/big_tuples.cc compilation failed to produce 
executable
FAIL: 20_util/tuple/cons/constructor.cc (test for excess errors)
WARNING: 20_util/tuple/cons/constructor.cc compilation failed to produce 
executable

All these failures are similar to the problem I describe in another 
email: when passing a tuple object to initialize another tuple object 
the wrong constructor is being selected.

--
  P.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: move_only_element.cc
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20080216/2bb94bc8/attachment.cc>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tuple.patch
Type: text/x-patch
Size: 5485 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20080216/2bb94bc8/attachment.bin>


More information about the Libstdc++ mailing list