This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/56785] std::tuple of two elements does not apply empty base class optimization when one of its elements is a std::tuple with two elements


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56785

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Eelis from comment #2)
> Another manifestation of this is that 
> 
>   sizeof(pair<pair<char,char>,pair<char,char>>) == 4
> 
> while
> 
>   sizeof(tuple<tuple<char,char>,tuple<char,char>>) == 5 (!!).

Oh noes, one byte more for a silly edge case!

> I think that at the moment, GCC users are best advised to avoid using stdlib
> tuples if efficiency is a concern.

That's a ridiculous conclusion to reach based on an edge case.

There are many realistic situations where std::tuple is more compact that
std::pair.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]