]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Refactor std::list::size() for cxx11 ABI
authorJonathan Wakely <jwakely@redhat.com>
Tue, 12 Nov 2024 15:36:17 +0000 (15:36 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 3 Dec 2024 21:34:24 +0000 (21:34 +0000)
commitca24f585fc3b7bf5e145cf3ee3f6f83ad8a4f2dd
tree5990f7f2786e00bc5a8e7cc42ca7bebba045dc89
parent5aa4ab4d62f4b6c6e1b0ceb746582bdac3bb14a9
libstdc++: Refactor std::list::size() for cxx11 ABI

Remove some preprocessor conditionals by moving the _M_size member for
the cxx11 ABI into a new base class, which is empty for the gcc4-compat
ABI.

Move some unused members that are only retained for ABI compatibility to
the end of _List_base and add an explanatory comment. Stop using
list::_M_node_count and list::_D_distance and then move them to the end
of std::list with a comment too.

libstdc++-v3/ChangeLog:

* include/bits/stl_list.h (_List_size): New struct.
(_List_node_header): Replace _M_size member with _List_size base
class.
(_List_node_header(_List_node_header&&)): Replace explicit uses
of _M_size with initializing the base.
(_List_node_header::_M_init): Likewise.
(_List_base::_S_distance, _List_base::_M_distance)
(_List_base::_M_node_count): Move to end of class body and add
comment.
(list::_S_distance, list::_M_node_count): Likewise.
(list::size): Inline _M_node_count effects to here.
(list::splice(iterator, list&, iterator, iterator)): Use #if and
call std::distance instead of _S_distance.
libstdc++-v3/include/bits/stl_list.h