This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/51453] New: Feature request: Implement Empty Base Optimization in std::tuple
- From: "nasos_i at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 07 Dec 2011 17:50:36 +0000
- Subject: [Bug c++/51453] New: Feature request: Implement Empty Base Optimization in std::tuple
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51453
Bug #: 51453
Summary: Feature request: Implement Empty Base Optimization in
std::tuple
Classification: Unclassified
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: nasos_i@hotmail.com
Is it possible to implement empty base optimization on std::tuple, so that
tuples with member free elements have no memory footprint?
struct _Tuple_impl<_Idx>
{
...
protected:
short dummy[0]; // NEW
void _M_swap_impl(_Tuple_impl&) { /* no-op */ }
};
simple test:
#include <tuple>
...
class empty { short d[0]; };
std::tuple<empty, empty, empty> a;
std::cout << sizeof(a) << std::endl; // 2 without tuple ebo (current), and
0 with tuple ebo
...
Best,
Nasos