diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2016-07-04 15:52:46 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2016-07-04 15:52:46 +0100 |
commit | 9958c7eb586f40860546007fe0dc27165275c80d (patch) | |
tree | 4b2a3c27c66a41421f137be57c5d0b026e557dea /gcc/tree.c | |
parent | bf7499197fbb065123257c374064f6bb715c951b (diff) | |
download | gcc-9958c7eb586f40860546007fe0dc27165275c80d.zip gcc-9958c7eb586f40860546007fe0dc27165275c80d.tar.gz gcc-9958c7eb586f40860546007fe0dc27165275c80d.tar.bz2 |
Fix std::vector's use of temporary objects
* include/bits/stl_vector.h (emplace(const_iterator, _Args&&...)):
Define inline. Forward to _M_emplace_aux.
(insert(const_iterator, value_type&&)): Forward to _M_insert_rval.
(_M_insert_rval, _M_emplace_aux): Declare new functions.
(_Temporary_value): New RAII type using allocator to construct/destroy.
(_S_insert_aux_assign): Remove.
(_M_insert_aux): Make non-variadic.
* include/bits/vector.tcc (insert(const_iterator, const value_type&)):
Use _Temporary_value.
(emplace(const_iterator, _Args&&...)): Remove definition.
(_M_insert_rval, _M_emplace_aux): Define.
(_M_insert_aux): Make non-variadic, stop using _S_insert_aux_assign.
(_M_fill_insert): Use _Temporary_value.
* testsuite/23_containers/vector/allocator/construction.cc: New test.
* testsuite/23_containers/vector/modifiers/insert_vs_emplace.cc:
Adjust expected results for emplacing an lvalue with reallocation.
* testsuite/23_containers/vector/check_construct_destroy.cc: Adjust
expected results to account for construction/destruction of temporary
using allocator.
From-SVN: r237985
Diffstat (limited to 'gcc/tree.c')
0 files changed, 0 insertions, 0 deletions