Define __cpp_lib_erase_if feature test macro
authorJonathan Wakely <jwakely@redhat.com>
Thu, 10 Jan 2019 13:49:31 +0000 (13:49 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 10 Jan 2019 13:49:31 +0000 (13:49 +0000)
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.

From-SVN: r267810

16 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/erase_if.h
libstdc++-v3/include/std/deque
libstdc++-v3/include/std/forward_list
libstdc++-v3/include/std/list
libstdc++-v3/include/std/string
libstdc++-v3/include/std/vector
libstdc++-v3/include/std/version
libstdc++-v3/testsuite/23_containers/deque/erasure.cc
libstdc++-v3/testsuite/23_containers/forward_list/erasure.cc
libstdc++-v3/testsuite/23_containers/list/erasure.cc
libstdc++-v3/testsuite/23_containers/map/erasure.cc
libstdc++-v3/testsuite/23_containers/set/erasure.cc
libstdc++-v3/testsuite/23_containers/unordered_map/erasure.cc
libstdc++-v3/testsuite/23_containers/unordered_set/erasure.cc
libstdc++-v3/testsuite/23_containers/vector/erasure.cc

index 19a12f8e1637a1c5cc0fe4a25298547be4aff4db..00ebdddea7256e038c0650221d8a0319da4744f7 100644 (file)
@@ -1,5 +1,22 @@
 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
index 9e865c6abb5d6c74efbec5d5802841070931672f..d84f5ffc8ed9fba2768dfc0c877cdfea14a79831 100644 (file)
@@ -38,6 +38,8 @@ namespace std
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
+#define __cpp_lib_erase_if 201900L
+
   namespace __detail
   {
     template<typename _Container, typename _Predicate>
index 7932b1cdea57640f31e0432d7c7bd2231545f078..ed4927e13b740e81d869d4ecdb9221d05812acb5 100644 (file)
@@ -94,6 +94,9 @@ _GLIBCXX_END_NAMESPACE_VERSION
 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)
index 93c95904fc306eec4e62482ccc60ee7baf3b8798..3d3b6d4f5f6dd315017709848b7986cd0c330931 100644 (file)
@@ -65,6 +65,9 @@ _GLIBCXX_END_NAMESPACE_VERSION
 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)
index 5ea9a9619ba913ef58822e9ed40d65dd480990bf..7b02e8685d48e4ee89cb4f520436857d1f379085 100644 (file)
@@ -89,6 +89,9 @@ _GLIBCXX_END_NAMESPACE_VERSION
 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)
index dc718b873575d20a7ab1314fdb5cd353e9c87475..caa54c2410045d051dab6afe47388c22388db175 100644 (file)
@@ -79,6 +79,9 @@ _GLIBCXX_END_NAMESPACE_VERSION
 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
index 059451801cb2e2f68cc16315682269e2fef042c8..2c90765b0589fdd1a1b9a1c181af343bf7e8c0fd 100644 (file)
@@ -97,6 +97,9 @@ _GLIBCXX_END_NAMESPACE_VERSION
 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)
index f090fba03086484a3ee9c08528cde24d29290ecb..e11ae3a688a72427597d3ce2f41be8f047e36a49 100644 (file)
@@ -96,6 +96,7 @@
 #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
index 4fe6f1d0d6fc99cdba637f6c85a92fcb15beb060..39ea6deecc2a467f75a78950172694f1c5b2a72c 100644 (file)
 #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()
 {
index 3d5c9fdcd578b56b5ab9027ebcaf03de6b26bf08..724a720f6549e3a722d6424c987623b6681a8bbe 100644 (file)
 #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()
 {
index 87dfee990fc99a1ce104fff0e1e4d9ae90ef5c84..a9927b484e153fefb665505243f024f054e8c3e8 100644 (file)
 #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()
 {
index a19e805f7fc70db386d8fc7f68e56870450f41f5..d8a57160865a757af79685257cb782c676cf4d05 100644 (file)
 #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;
index 0e178e9a177b7ff8d787d01e7f0afa7142c375ca..2412d69f75c06acdf50106756dd045493b0d1578 100644 (file)
 #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
index f652dd2b5a7932599b25f476ffbec8ddb1fe8418..35190a0d19e81e098a35ca56b1c36a1c3a08ea05 100644 (file)
 #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;
index 3f59bfdc20559eba1de069c8fd06e6c09ac10a08..5ffabf538bdc64515c29a1ec885c52f7b5fb9d6b 100644 (file)
 #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()
 {
index 9868252816c7c77be9388fc5c21baa3522240631..0a23c3f0d12dfc796482e8158b32d86a7f26bb4a 100644 (file)
 #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()
 {