stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <>
Subject Re: Tuple status
Date Tue, 08 Jul 2008 01:24:44 GMT
Eric Lemings wrote:
> ...
>>> Without the cast, the argument type passed to the internal ctor is
>>> still `std::tuple<_TypesT...>' and, because of the template ctors,
>>> the compiler would therefore bind to the templated copy ctor wisely
>>> deeming this ctor a better "fit".
>> Would this be prevented by not deriving tuple from __rw_tuple (or
>> not deriving it directly)? FWIW, it seems to me that in order to
>> implement the space optimization we discussed this morning, we
>> might need to make some changes in this area anyway. We should
>> keep the cast issue in mind while designing a solution.
> I'll have to look into this further but I'm almost certain the changes
> required to implement this optimization would make the code even more
> complicated and -- if the solution is what I think it may be -- might
> even require another base class and possibly more casts.

FWIW, in case you haven't seen the tuple mock up posted by Howard
to, read c++std-lib-21810. Let me quote the
last paragraph from his post:

     Btw, this prototype does the empty member optimization.  Last
     time I checked with the LWG, this was to be allowed but not
     required.  I hoping we still feel that way.  As far as I know,
     the current WP text implies this by not saying otherwise, and
     by not saying too much about the layout.  It is my hope that
     ultimately clients will be able to portably depend on this

     struct Empty {};
     static_assert(sizeof(tuple<int, Empty>)      ==   sizeof(int), 
"Please implement empty member optimization in tuple");
     static_assert(sizeof(tuple<int, Empty, int>) == 2*sizeof(int), 
"Please implement empty member optimization in tuple");

View raw message