The C++2a draft specifies the value 201811L for this, but as an
extension we return the number of elements erased. This is expected to
be standardised, so the macro has the value 201900L until a proper value
is specified in the draft.
* include/bits/erase_if.h: Define __cpp_lib_erase_if.
* include/std/deque: Likewise.
* include/std/forward_list: Likewise.
* include/std/list: Likewise.
* include/std/string: Likewise.
* include/std/vector: Likewise.
* include/std/version: Likewise.
* testsuite/21_strings/basic_string/erasure.cc: Test macro.
* testsuite/23_containers/deque/erasure.cc: Likewise.
* testsuite/23_containers/forward_list/erasure.cc: Likewise.
* testsuite/23_containers/list/erasure.cc: Likewise.
* testsuite/23_containers/map/erasure.cc: Likewise.
* testsuite/23_containers/set/erasure.cc: Likewise.
* testsuite/23_containers/unordered_map/erasure.cc: Likewise.
* testsuite/23_containers/unordered_set/erasure.cc: Likewise.
* testsuite/23_containers/vector/erasure.cc: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@267810
138bc75d-0d04-0410-961f-
82ee72b054a4
2019-01-10 Jonathan Wakely <jwakely@redhat.com>
+ * include/bits/erase_if.h: Define __cpp_lib_erase_if.
+ * include/std/deque: Likewise.
+ * include/std/forward_list: Likewise.
+ * include/std/list: Likewise.
+ * include/std/string: Likewise.
+ * include/std/vector: Likewise.
+ * include/std/version: Likewise.
+ * testsuite/21_strings/basic_string/erasure.cc: Test macro.
+ * testsuite/23_containers/deque/erasure.cc: Likewise.
+ * testsuite/23_containers/forward_list/erasure.cc: Likewise.
+ * testsuite/23_containers/list/erasure.cc: Likewise.
+ * testsuite/23_containers/map/erasure.cc: Likewise.
+ * testsuite/23_containers/set/erasure.cc: Likewise.
+ * testsuite/23_containers/unordered_map/erasure.cc: Likewise.
+ * testsuite/23_containers/unordered_set/erasure.cc: Likewise.
+ * testsuite/23_containers/vector/erasure.cc: Likewise.
+
* include/experimental/internet [AI_NUMERICSERV]
(resolver_base::numeric_service): Define conditionally.
* testsuite/experimental/net/internet/resolver/base.cc: Test it
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+#define __cpp_lib_erase_if 201900L
+
namespace __detail
{
template<typename _Container, typename _Predicate>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+#define __cpp_lib_erase_if 201900L
+
template<typename _Tp, typename _Alloc, typename _Predicate>
inline typename deque<_Tp, _Alloc>::size_type
erase_if(deque<_Tp, _Alloc>& __cont, _Predicate __pred)
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+#define __cpp_lib_erase_if 201900L
+
template<typename _Tp, typename _Alloc, typename _Predicate>
inline typename forward_list<_Tp, _Alloc>::size_type
erase_if(forward_list<_Tp, _Alloc>& __cont, _Predicate __pred)
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+#define __cpp_lib_erase_if 201900L
+
template<typename _Tp, typename _Alloc, typename _Predicate>
inline typename list<_Tp, _Alloc>::size_type
erase_if(list<_Tp, _Alloc>& __cont, _Predicate __pred)
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+#define __cpp_lib_erase_if 201900L
+
template<typename _CharT, typename _Traits, typename _Alloc,
typename _Predicate>
inline typename basic_string<_CharT, _Traits, _Alloc>::size_type
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+#define __cpp_lib_erase_if 201900L
+
template<typename _Tp, typename _Alloc, typename _Predicate>
inline typename vector<_Tp, _Alloc>::size_type
erase_if(vector<_Tp, _Alloc>& __cont, _Predicate __pred)
#define __cpp_lib_clamp 201603
#define __cpp_lib_constexpr_char_traits 201611
#define __cpp_lib_enable_shared_from_this 201603
+#define __cpp_lib_erase_if 201900L
#define __cpp_lib_filesystem 201703
#define __cpp_lib_gcd 201606
#define __cpp_lib_gcd_lcm 201606
#include <deque>
#include <testsuite_hooks.h>
+#ifndef __cpp_lib_erase_if
+# error "Feature-test macro for erase_if missing"
+#elif __cpp_lib_erase_if < 201811
+# error "Feature-test macro for erase_if has wrong value"
+#endif
+
void
test01()
{
#include <forward_list>
#include <testsuite_hooks.h>
+#ifndef __cpp_lib_erase_if
+# error "Feature-test macro for erase_if missing"
+#elif __cpp_lib_erase_if < 201811
+# error "Feature-test macro for erase_if has wrong value"
+#endif
+
void
test01()
{
#include <list>
#include <testsuite_hooks.h>
+#ifndef __cpp_lib_erase_if
+# error "Feature-test macro for erase_if missing"
+#elif __cpp_lib_erase_if < 201811
+# error "Feature-test macro for erase_if has wrong value"
+#endif
+
void
test01()
{
#include <map>
#include <testsuite_hooks.h>
+#ifndef __cpp_lib_erase_if
+# error "Feature-test macro for erase_if missing"
+#elif __cpp_lib_erase_if < 201811
+# error "Feature-test macro for erase_if has wrong value"
+#endif
+
auto is_odd_pair = [](const std::pair<const int, std::string>& p)
{
return p.first % 2 != 0;
#include <set>
#include <testsuite_hooks.h>
+#ifndef __cpp_lib_erase_if
+# error "Feature-test macro for erase_if missing"
+#elif __cpp_lib_erase_if < 201811
+# error "Feature-test macro for erase_if has wrong value"
+#endif
+
auto is_odd = [](const int i) { return i % 2 != 0; };
void
#include <unordered_map>
#include <testsuite_hooks.h>
+#ifndef __cpp_lib_erase_if
+# error "Feature-test macro for erase_if missing"
+#elif __cpp_lib_erase_if < 201811
+# error "Feature-test macro for erase_if has wrong value"
+#endif
+
auto is_odd_pair = [](const std::pair<const int, std::string>& p)
{
return p.first % 2 != 0;
#include <unordered_set>
#include <testsuite_hooks.h>
+#ifndef __cpp_lib_erase_if
+# error "Feature-test macro for erase_if missing"
+#elif __cpp_lib_erase_if < 201811
+# error "Feature-test macro for erase_if has wrong value"
+#endif
+
void
test01()
{
#include <vector>
#include <testsuite_hooks.h>
+#ifndef __cpp_lib_erase_if
+# error "Feature-test macro for erase_if missing"
+#elif __cpp_lib_erase_if < 201811
+# error "Feature-test macro for erase_if has wrong value"
+#endif
+
void
test01()
{