Fix erasure goofs.

2018-11-29  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Fix erasure goofs.
	* include/experimental/deque: Make inline.
	* include/std/deque: Include bits/stl_algo.h.
	(erase, erase_if): Make inline.
	* include/std/string: Include bits/stl_algo.h.
	* include/std/unordered_set: Add erase, erase_if!
	* include/std/vector: Include bits/stl_algo.h.
	* testsuite/21_strings/basic_string/erasure.cc:
	Add { dg-options "-std=gnu++2a" }.
	* testsuite/23_containers/deque/erasure.cc: Ditto.
	* testsuite/23_containers/forward_list/erasure.cc: Ditto.
	* testsuite/23_containers/list/erasure.cc: Ditto.
	* testsuite/23_containers/map/erasure.cc: Ditto.
	* testsuite/23_containers/set/erasure.cc: Ditto.
	* testsuite/23_containers/unordered_map/erasure.cc: Ditto.
	* testsuite/23_containers/unordered_set/erasure.cc: Ditto.
	* testsuite/23_containers/vector/erasure.cc: Ditto.

From-SVN: r266616
This commit is contained in:
Edward Smith-Rowland 2018-11-29 13:43:55 +00:00 committed by Edward Smith-Rowland
parent 154fb72b6d
commit a62b871d65
15 changed files with 49 additions and 5 deletions

View File

@ -1,3 +1,23 @@
2018-11-29 Edward Smith-Rowland <3dw4rd@verizon.net>
Fix erasure goofs.
* include/experimental/deque: Make inline.
* include/std/deque: Include bits/stl_algo.h.
(erase, erase_if): Make inline.
* include/std/string: Include bits/stl_algo.h.
* include/std/unordered_set: Add erase, erase_if!
* include/std/vector: Include bits/stl_algo.h.
* testsuite/21_strings/basic_string/erasure.cc:
Add { dg-options "-std=gnu++2a" }.
* testsuite/23_containers/deque/erasure.cc: Ditto.
* testsuite/23_containers/forward_list/erasure.cc: Ditto.
* testsuite/23_containers/list/erasure.cc: Ditto.
* testsuite/23_containers/map/erasure.cc: Ditto.
* testsuite/23_containers/set/erasure.cc: Ditto.
* testsuite/23_containers/unordered_map/erasure.cc: Ditto.
* testsuite/23_containers/unordered_set/erasure.cc: Ditto.
* testsuite/23_containers/vector/erasure.cc: Ditto.
2018-11-29 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/88119

View File

@ -46,7 +46,7 @@ namespace experimental
inline namespace fundamentals_v2
{
template<typename _Tp, typename _Alloc, typename _Predicate>
void
inline void
erase_if(deque<_Tp, _Alloc>& __cont, _Predicate __pred)
{
__cont.erase(std::remove_if(__cont.begin(), __cont.end(), __pred),
@ -54,7 +54,7 @@ inline namespace fundamentals_v2
}
template<typename _Tp, typename _Alloc, typename _Up>
void
inline void
erase(deque<_Tp, _Alloc>& __cont, const _Up& __value)
{
__cont.erase(std::remove(__cont.begin(), __cont.end(), __value),

View File

@ -58,6 +58,7 @@
#pragma GCC system_header
#include <bits/stl_algobase.h>
#include <bits/stl_algo.h> // For remove and remove_if
#include <bits/allocator.h>
#include <bits/stl_construct.h>
#include <bits/stl_uninitialized.h>
@ -92,7 +93,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Tp, typename _Alloc, typename _Predicate>
void
inline void
erase_if(deque<_Tp, _Alloc>& __cont, _Predicate __pred)
{
__cont.erase(std::remove_if(__cont.begin(), __cont.end(), __pred),
@ -100,7 +101,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
template<typename _Tp, typename _Alloc, typename _Up>
void
inline void
erase(deque<_Tp, _Alloc>& __cont, const _Up& __value)
{
__cont.erase(std::remove(__cont.begin(), __cont.end(), __value),

View File

@ -48,10 +48,10 @@
#include <bits/stl_function.h> // For less
#include <ext/numeric_traits.h>
#include <bits/stl_algobase.h>
#include <bits/stl_algo.h> // For remove and remove_if
#include <bits/range_access.h>
#include <bits/basic_string.h>
#include <bits/basic_string.tcc>
#include <algorithm> // For remove and remove_if
#if __cplusplus >= 201703L && _GLIBCXX_USE_CXX11_ABI
namespace std _GLIBCXX_VISIBILITY(default)

View File

@ -82,6 +82,19 @@ _GLIBCXX_END_NAMESPACE_VERSION
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Key, typename _Hash, typename _CPred, typename _Alloc,
typename _Predicate>
inline void
erase_if(unordered_set<_Key, _Hash, _CPred, _Alloc>& __cont,
_Predicate __pred)
{ std::__detail::__erase_nodes_if(__cont, __pred); }
template<typename _Key, typename _Hash, typename _CPred, typename _Alloc,
typename _Predicate>
inline void
erase_if(unordered_multiset<_Key, _Hash, _CPred, _Alloc>& __cont,
_Predicate __pred)
{ std::__detail::__erase_nodes_if(__cont, __pred); }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++20

View File

@ -58,6 +58,7 @@
#pragma GCC system_header
#include <bits/stl_algobase.h>
#include <bits/stl_algo.h> // For remove and remove_if
#include <bits/allocator.h>
#include <bits/stl_construct.h>
#include <bits/stl_uninitialized.h>

View File

@ -1,3 +1,4 @@
// { dg-options "-std=gnu++2a" }
// { dg-do run { target c++2a } }
// Copyright (C) 2018 Free Software Foundation, Inc.

View File

@ -1,3 +1,4 @@
// { dg-options "-std=gnu++2a" }
// { dg-do run { target c++2a } }
// Copyright (C) 2018 Free Software Foundation, Inc.

View File

@ -1,3 +1,4 @@
// { dg-options "-std=gnu++2a" }
// { dg-do run { target c++2a } }
// Copyright (C) 2018 Free Software Foundation, Inc.

View File

@ -1,3 +1,4 @@
// { dg-options "-std=gnu++2a" }
// { dg-do run { target c++2a } }
// Copyright (C) 2018 Free Software Foundation, Inc.

View File

@ -1,3 +1,4 @@
// { dg-options "-std=gnu++2a" }
// { dg-do run { target c++2a } }
// Copyright (C) 2018 Free Software Foundation, Inc.

View File

@ -1,3 +1,4 @@
// { dg-options "-std=gnu++2a" }
// { dg-do run { target c++2a } }
// Copyright (C) 2018 Free Software Foundation, Inc.

View File

@ -1,3 +1,4 @@
// { dg-options "-std=gnu++2a" }
// { dg-do run { target c++2a } }
// Copyright (C) 2018 Free Software Foundation, Inc.

View File

@ -1,3 +1,4 @@
// { dg-options "-std=gnu++2a" }
// { dg-do run { target c++2a } }
// Copyright (C) 2018 Free Software Foundation, Inc.

View File

@ -1,3 +1,4 @@
// { dg-options "-std=gnu++2a" }
// { dg-do run { target c++2a } }
// Copyright (C) 2018 Free Software Foundation, Inc.