http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46821
Summary: swapping empty classes
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: [email protected]
ReportedBy: [email protected]
Hello,
I noticed in the implementation of std::tuple that when a type is empty, swap
is implemented as:
void
_M_swap_impl(_Head&) { /* no-op */ }
and was wondering whether that was safe. Can't an empty type have copy, move,
assignment or swap with a non-trivial semantic? The object still has a unique
address, it could register it (in constructors) in a global data structure for
instance, and have assignment and swap change things in that data structure.