This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[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
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 16 Jun 2014 22:10:45 +0000
- Subject: [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
- Auto-submitted: auto-generated
- References: <bug-56785-4 at http dot gcc dot gnu dot org/bugzilla/>
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.