diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2020-10-19 17:56:54 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2020-10-19 18:06:51 +0100 |
commit | aa6d2be1e3455a5f0818d5bd6a44b15a55a39df5 (patch) | |
tree | c8a40f330e254694f872eb33da58e496626c1d26 /gcc/tree-complex.c | |
parent | 5abe05b4331250b6a7798ce87c0a82adc2bd70f3 (diff) | |
download | gcc-aa6d2be1e3455a5f0818d5bd6a44b15a55a39df5.zip gcc-aa6d2be1e3455a5f0818d5bd6a44b15a55a39df5.tar.gz gcc-aa6d2be1e3455a5f0818d5bd6a44b15a55a39df5.tar.bz2 |
libstdc++: Optimize container node-handle type for size
The use of std::optional in _Node_handle makes the node handle types for
associative and unordered containers larger than necessary. It also
greatly increases the amount of code included, as <optional> is quite
large.
The boolean flag that records whether the std::optional contains a value
is redundant, because the _Node_handle::_M_ptr member provides the same
information. If the node handle has a non-null pointer it also has an
allocator, and not otherwise. By replacing std::optional with a custom
union type (and using _M_ptr to tell which union member is active) all
node handle sizes can be reduced by sizeof(allocator_type::pointer).
This makes the node handle types incompatible with previous releases, so
must be done before the C++17 ABI is fixed for GCC 11.
libstdc++-v3/ChangeLog:
* include/bits/node_handle.h (_Node_handle_common): Replace
std::optional with custom type.
* testsuite/20_util/variant/exception_safety.cc: Add missing
header include.
Diffstat (limited to 'gcc/tree-complex.c')
0 files changed, 0 insertions, 0 deletions