diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2021-12-03 11:16:30 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2021-12-03 22:52:27 +0000 |
commit | bf548ce3e67276aa429b462cf41e68891fdf40c2 (patch) | |
tree | 313a70b2cb1aaf41a37fbeedfc9f7d01c1815208 /gcc/tree-ssa-loop-prefetch.c | |
parent | f78eaffd1538efb46953a8bf90e9b95661fcfb33 (diff) | |
download | gcc-bf548ce3e67276aa429b462cf41e68891fdf40c2.zip gcc-bf548ce3e67276aa429b462cf41e68891fdf40c2.tar.gz gcc-bf548ce3e67276aa429b462cf41e68891fdf40c2.tar.bz2 |
libstdc++: Simplify emplace member functions in _Rb_tree
This introduces a new RAII type to simplify the emplace members which
currently use try-catch blocks to deallocate a node if an exception is
thrown by the comparisons done during insertion. The new type is created
on the stack and manages the allocation of a new node and deallocates it
in the destructor if it wasn't inserted into the tree. It also provides
helper functions for doing the insertion, releasing ownership of the
node to the tree.
Also, we don't need to use long qualified names if we put the return
type after the nested-name-specifier.
libstdc++-v3/ChangeLog:
* include/bits/stl_tree.h (_Rb_tree::_Auto_node): Define new
RAII helper for creating and inserting new nodes.
(_Rb_tree::_M_insert_node): Use trailing-return-type to simplify
out-of-line definition.
(_Rb_tree::_M_insert_lower_node): Likewise.
(_Rb_tree::_M_insert_equal_lower_node): Likewise.
(_Rb_tree::_M_emplace_unique): Likewise. Use _Auto_node.
(_Rb_tree::_M_emplace_equal): Likewise.
(_Rb_tree::_M_emplace_hint_unique): Likewise.
(_Rb_tree::_M_emplace_hint_equal): Likewise.
Diffstat (limited to 'gcc/tree-ssa-loop-prefetch.c')
0 files changed, 0 insertions, 0 deletions