Index: libcxx/www/cxx2a_status.html
===================================================================
--- libcxx/www/cxx2a_status.html
+++ libcxx/www/cxx2a_status.html
@@ -227,7 +227,7 @@
| | | | | |
P0586 | LWG | Safe integral comparisons | Prague | | |
P0593 | CWG | Implicit creation of objects for low-level object manipulation | Prague | | |
- P1115 | LWG | Improving the Return Value of Erase-Like Algorithms II: Free erase/erase if | Prague | | |
+ P1115 | LWG | Improving the Return Value of Erase-Like Algorithms II: Free erase/erase if | Prague | Complete | 11.0 |
P1243 | LWG | Rangify New Algorithms | Prague | | |
P1460 | LWG | Mandating the Standard Library: Clause 20 - Utilities library | Prague | | |
P1739 | LWG | Avoid template bloat for safe_ranges in combination with "subrange-y" view adaptors | Prague | | |
Index: libcxx/utils/generate_feature_test_macro_components.py
===================================================================
--- libcxx/utils/generate_feature_test_macro_components.py
+++ libcxx/utils/generate_feature_test_macro_components.py
@@ -475,7 +475,7 @@
},
{"name": "__cpp_lib_erase_if",
"values": {
- "c++2a": int(201811),
+ "c++2a": int(202002),
},
"headers": ["string", "deque", "forward_list", "list", "vector", "map",
"set", "unordered_map", "unordered_set"]
@@ -588,7 +588,7 @@
},
{"name": "__cpp_lib_to_array",
"values": {
- "c++2a": 201907L,
+ "c++2a": int(201907),
},
"headers": ["array"],
},
Index: libcxx/test/std/strings/strings.erasure/erase_if.pass.cpp
===================================================================
--- libcxx/test/std/strings/strings.erasure/erase_if.pass.cpp
+++ libcxx/test/std/strings/strings.erasure/erase_if.pass.cpp
@@ -10,7 +10,8 @@
//
// template
-// void erase_if(basic_string& c, Predicate pred);
+// typename basic_string::size_type
+// erase_if(basic_string& c, Predicate pred);
#include
@@ -19,13 +20,11 @@
#include "min_allocator.h"
template
-void
-test0(S s, Pred p, S expected)
-{
- ASSERT_SAME_TYPE(void, decltype(std::erase_if(s, p)));
- std::erase_if(s, p);
- LIBCPP_ASSERT(s.__invariants());
- assert(s == expected);
+void test0(S s, Pred p, S expected, size_t expected_erased_count) {
+ ASSERT_SAME_TYPE(typename S::size_type, decltype(std::erase_if(s, p)));
+ assert(expected_erased_count == std::erase_if(s, p));
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
}
template
@@ -38,33 +37,33 @@
auto True = [](auto) { return true; };
auto False = [](auto) { return false; };
- test0(S(""), isA, S(""));
+ test0(S(""), isA, S(""), 0);
- test0(S("a"), isA, S(""));
- test0(S("a"), isB, S("a"));
+ test0(S("a"), isA, S(""), 1);
+ test0(S("a"), isB, S("a"), 0);
- test0(S("ab"), isA, S("b"));
- test0(S("ab"), isB, S("a"));
- test0(S("ab"), isC, S("ab"));
- test0(S("aa"), isA, S(""));
- test0(S("aa"), isC, S("aa"));
+ test0(S("ab"), isA, S("b"), 1);
+ test0(S("ab"), isB, S("a"), 1);
+ test0(S("ab"), isC, S("ab"), 0);
+ test0(S("aa"), isA, S(""), 2);
+ test0(S("aa"), isC, S("aa"), 0);
- test0(S("abc"), isA, S("bc"));
- test0(S("abc"), isB, S("ac"));
- test0(S("abc"), isC, S("ab"));
- test0(S("abc"), isD, S("abc"));
+ test0(S("abc"), isA, S("bc"), 1);
+ test0(S("abc"), isB, S("ac"), 1);
+ test0(S("abc"), isC, S("ab"), 1);
+ test0(S("abc"), isD, S("abc"), 0);
- test0(S("aab"), isA, S("b"));
- test0(S("aab"), isB, S("aa"));
- test0(S("aab"), isC, S("aab"));
- test0(S("abb"), isA, S("bb"));
- test0(S("abb"), isB, S("a"));
- test0(S("abb"), isC, S("abb"));
- test0(S("aaa"), isA, S(""));
- test0(S("aaa"), isB, S("aaa"));
+ test0(S("aab"), isA, S("b"), 2);
+ test0(S("aab"), isB, S("aa"), 1);
+ test0(S("aab"), isC, S("aab"), 0);
+ test0(S("abb"), isA, S("bb"), 1);
+ test0(S("abb"), isB, S("a"), 2);
+ test0(S("abb"), isC, S("abb"), 0);
+ test0(S("aaa"), isA, S(""), 3);
+ test0(S("aaa"), isB, S("aaa"), 0);
- test0(S("aba"), False, S("aba"));
- test0(S("aba"), True, S(""));
+ test0(S("aba"), False, S("aba"), 0);
+ test0(S("aba"), True, S(""), 3);
}
int main(int, char**)
Index: libcxx/test/std/strings/strings.erasure/erase.pass.cpp
===================================================================
--- libcxx/test/std/strings/strings.erasure/erase.pass.cpp
+++ libcxx/test/std/strings/strings.erasure/erase.pass.cpp
@@ -10,8 +10,8 @@
//
// template
-// void erase(basic_string& c, const U& value);
-
+// typename basic_string::size_type
+// erase(basic_string& c, const U& value);
#include
#include
@@ -21,50 +21,48 @@
#include "min_allocator.h"
template
-void
-test0(S s, U val, S expected)
-{
- ASSERT_SAME_TYPE(void, decltype(std::erase(s, val)));
- std::erase(s, val);
- LIBCPP_ASSERT(s.__invariants());
- assert(s == expected);
+void test0(S s, U val, S expected, size_t expected_erased_count) {
+ ASSERT_SAME_TYPE(typename S::size_type, decltype(std::erase(s, val)));
+ assert(expected_erased_count == std::erase(s, val));
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
}
template
void test()
{
- test0(S(""), 'a', S(""));
+ test0(S(""), 'a', S(""), 0);
- test0(S("a"), 'a', S(""));
- test0(S("a"), 'b', S("a"));
+ test0(S("a"), 'a', S(""), 1);
+ test0(S("a"), 'b', S("a"), 0);
- test0(S("ab"), 'a', S("b"));
- test0(S("ab"), 'b', S("a"));
- test0(S("ab"), 'c', S("ab"));
- test0(S("aa"), 'a', S(""));
- test0(S("aa"), 'c', S("aa"));
+ test0(S("ab"), 'a', S("b"), 1);
+ test0(S("ab"), 'b', S("a"), 1);
+ test0(S("ab"), 'c', S("ab"), 0);
+ test0(S("aa"), 'a', S(""), 2);
+ test0(S("aa"), 'c', S("aa"), 0);
- test0(S("abc"), 'a', S("bc"));
- test0(S("abc"), 'b', S("ac"));
- test0(S("abc"), 'c', S("ab"));
- test0(S("abc"), 'd', S("abc"));
+ test0(S("abc"), 'a', S("bc"), 1);
+ test0(S("abc"), 'b', S("ac"), 1);
+ test0(S("abc"), 'c', S("ab"), 1);
+ test0(S("abc"), 'd', S("abc"), 0);
- test0(S("aab"), 'a', S("b"));
- test0(S("aab"), 'b', S("aa"));
- test0(S("aab"), 'c', S("aab"));
- test0(S("abb"), 'a', S("bb"));
- test0(S("abb"), 'b', S("a"));
- test0(S("abb"), 'c', S("abb"));
- test0(S("aaa"), 'a', S(""));
- test0(S("aaa"), 'b', S("aaa"));
+ test0(S("aab"), 'a', S("b"), 2);
+ test0(S("aab"), 'b', S("aa"), 1);
+ test0(S("aab"), 'c', S("aab"), 0);
+ test0(S("abb"), 'a', S("bb"), 1);
+ test0(S("abb"), 'b', S("a"), 2);
+ test0(S("abb"), 'c', S("abb"), 0);
+ test0(S("aaa"), 'a', S(""), 3);
+ test0(S("aaa"), 'b', S("aaa"), 0);
-// Test cross-type erasure
- using opt = std::optional;
- test0(S("aba"), opt(), S("aba"));
- test0(S("aba"), opt('a'), S("b"));
- test0(S("aba"), opt('b'), S("aa"));
- test0(S("aba"), opt('c'), S("aba"));
+ // Test cross-type erasure
+ using opt = std::optional;
+ test0(S("aba"), opt(), S("aba"), 0);
+ test0(S("aba"), opt('a'), S("b"), 2);
+ test0(S("aba"), opt('b'), S("aa"), 1);
+ test0(S("aba"), opt('c'), S("aba"), 0);
}
int main(int, char**)
Index: libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
===================================================================
--- libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
+++ libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
@@ -38,7 +38,7 @@
__cpp_lib_destroying_delete 201806L [C++2a]
__cpp_lib_enable_shared_from_this 201603L [C++17]
__cpp_lib_endian 201907L [C++2a]
- __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_erase_if 202002L [C++2a]
__cpp_lib_exchange_function 201304L [C++14]
__cpp_lib_execution 201603L [C++17]
__cpp_lib_filesystem 201703L [C++17]
@@ -1718,8 +1718,8 @@
# ifndef __cpp_lib_erase_if
# error "__cpp_lib_erase_if should be defined in c++2a"
# endif
-# if __cpp_lib_erase_if != 201811L
-# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# if __cpp_lib_erase_if != 202002L
+# error "__cpp_lib_erase_if should have the value 202002L in c++2a"
# endif
# ifndef __cpp_lib_exchange_function
Index: libcxx/test/std/language.support/support.limits/support.limits.general/vector.version.pass.cpp
===================================================================
--- libcxx/test/std/language.support/support.limits/support.limits.general/vector.version.pass.cpp
+++ libcxx/test/std/language.support/support.limits/support.limits.general/vector.version.pass.cpp
@@ -15,7 +15,7 @@
/* Constant Value
__cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
- __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_erase_if 202002L [C++2a]
__cpp_lib_incomplete_container_elements 201505L [C++17]
__cpp_lib_nonmember_container_access 201411L [C++17]
*/
@@ -98,8 +98,8 @@
# ifndef __cpp_lib_erase_if
# error "__cpp_lib_erase_if should be defined in c++2a"
# endif
-# if __cpp_lib_erase_if != 201811L
-# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# if __cpp_lib_erase_if != 202002L
+# error "__cpp_lib_erase_if should have the value 202002L in c++2a"
# endif
# ifndef __cpp_lib_incomplete_container_elements
Index: libcxx/test/std/language.support/support.limits/support.limits.general/unordered_set.version.pass.cpp
===================================================================
--- libcxx/test/std/language.support/support.limits/support.limits.general/unordered_set.version.pass.cpp
+++ libcxx/test/std/language.support/support.limits/support.limits.general/unordered_set.version.pass.cpp
@@ -15,7 +15,7 @@
/* Constant Value
__cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
- __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_erase_if 202002L [C++2a]
__cpp_lib_generic_unordered_lookup 201811L [C++2a]
__cpp_lib_node_extract 201606L [C++17]
__cpp_lib_nonmember_container_access 201411L [C++17]
@@ -111,8 +111,8 @@
# ifndef __cpp_lib_erase_if
# error "__cpp_lib_erase_if should be defined in c++2a"
# endif
-# if __cpp_lib_erase_if != 201811L
-# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# if __cpp_lib_erase_if != 202002L
+# error "__cpp_lib_erase_if should have the value 202002L in c++2a"
# endif
# if !defined(_LIBCPP_VERSION)
Index: libcxx/test/std/language.support/support.limits/support.limits.general/unordered_map.version.pass.cpp
===================================================================
--- libcxx/test/std/language.support/support.limits/support.limits.general/unordered_map.version.pass.cpp
+++ libcxx/test/std/language.support/support.limits/support.limits.general/unordered_map.version.pass.cpp
@@ -15,7 +15,7 @@
/* Constant Value
__cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
- __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_erase_if 202002L [C++2a]
__cpp_lib_generic_unordered_lookup 201811L [C++2a]
__cpp_lib_node_extract 201606L [C++17]
__cpp_lib_nonmember_container_access 201411L [C++17]
@@ -127,8 +127,8 @@
# ifndef __cpp_lib_erase_if
# error "__cpp_lib_erase_if should be defined in c++2a"
# endif
-# if __cpp_lib_erase_if != 201811L
-# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# if __cpp_lib_erase_if != 202002L
+# error "__cpp_lib_erase_if should have the value 202002L in c++2a"
# endif
# if !defined(_LIBCPP_VERSION)
Index: libcxx/test/std/language.support/support.limits/support.limits.general/string.version.pass.cpp
===================================================================
--- libcxx/test/std/language.support/support.limits/support.limits.general/string.version.pass.cpp
+++ libcxx/test/std/language.support/support.limits/support.limits.general/string.version.pass.cpp
@@ -16,7 +16,7 @@
/* Constant Value
__cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
__cpp_lib_char8_t 201811L [C++2a]
- __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_erase_if 202002L [C++2a]
__cpp_lib_nonmember_container_access 201411L [C++17]
__cpp_lib_string_udls 201304L [C++14]
__cpp_lib_string_view 201606L [C++17]
@@ -143,8 +143,8 @@
# ifndef __cpp_lib_erase_if
# error "__cpp_lib_erase_if should be defined in c++2a"
# endif
-# if __cpp_lib_erase_if != 201811L
-# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# if __cpp_lib_erase_if != 202002L
+# error "__cpp_lib_erase_if should have the value 202002L in c++2a"
# endif
# ifndef __cpp_lib_nonmember_container_access
Index: libcxx/test/std/language.support/support.limits/support.limits.general/set.version.pass.cpp
===================================================================
--- libcxx/test/std/language.support/support.limits/support.limits.general/set.version.pass.cpp
+++ libcxx/test/std/language.support/support.limits/support.limits.general/set.version.pass.cpp
@@ -15,7 +15,7 @@
/* Constant Value
__cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
- __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_erase_if 202002L [C++2a]
__cpp_lib_generic_associative_lookup 201304L [C++14]
__cpp_lib_node_extract 201606L [C++17]
__cpp_lib_nonmember_container_access 201411L [C++17]
@@ -117,8 +117,8 @@
# ifndef __cpp_lib_erase_if
# error "__cpp_lib_erase_if should be defined in c++2a"
# endif
-# if __cpp_lib_erase_if != 201811L
-# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# if __cpp_lib_erase_if != 202002L
+# error "__cpp_lib_erase_if should have the value 202002L in c++2a"
# endif
# ifndef __cpp_lib_generic_associative_lookup
Index: libcxx/test/std/language.support/support.limits/support.limits.general/map.version.pass.cpp
===================================================================
--- libcxx/test/std/language.support/support.limits/support.limits.general/map.version.pass.cpp
+++ libcxx/test/std/language.support/support.limits/support.limits.general/map.version.pass.cpp
@@ -15,7 +15,7 @@
/* Constant Value
__cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
- __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_erase_if 202002L [C++2a]
__cpp_lib_generic_associative_lookup 201304L [C++14]
__cpp_lib_map_try_emplace 201411L [C++17]
__cpp_lib_node_extract 201606L [C++17]
@@ -133,8 +133,8 @@
# ifndef __cpp_lib_erase_if
# error "__cpp_lib_erase_if should be defined in c++2a"
# endif
-# if __cpp_lib_erase_if != 201811L
-# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# if __cpp_lib_erase_if != 202002L
+# error "__cpp_lib_erase_if should have the value 202002L in c++2a"
# endif
# ifndef __cpp_lib_generic_associative_lookup
Index: libcxx/test/std/language.support/support.limits/support.limits.general/list.version.pass.cpp
===================================================================
--- libcxx/test/std/language.support/support.limits/support.limits.general/list.version.pass.cpp
+++ libcxx/test/std/language.support/support.limits/support.limits.general/list.version.pass.cpp
@@ -15,7 +15,7 @@
/* Constant Value
__cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
- __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_erase_if 202002L [C++2a]
__cpp_lib_incomplete_container_elements 201505L [C++17]
__cpp_lib_list_remove_return_type 201806L [C++2a]
__cpp_lib_nonmember_container_access 201411L [C++17]
@@ -111,8 +111,8 @@
# ifndef __cpp_lib_erase_if
# error "__cpp_lib_erase_if should be defined in c++2a"
# endif
-# if __cpp_lib_erase_if != 201811L
-# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# if __cpp_lib_erase_if != 202002L
+# error "__cpp_lib_erase_if should have the value 202002L in c++2a"
# endif
# ifndef __cpp_lib_incomplete_container_elements
Index: libcxx/test/std/language.support/support.limits/support.limits.general/forward_list.version.pass.cpp
===================================================================
--- libcxx/test/std/language.support/support.limits/support.limits.general/forward_list.version.pass.cpp
+++ libcxx/test/std/language.support/support.limits/support.limits.general/forward_list.version.pass.cpp
@@ -15,7 +15,7 @@
/* Constant Value
__cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
- __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_erase_if 202002L [C++2a]
__cpp_lib_incomplete_container_elements 201505L [C++17]
__cpp_lib_list_remove_return_type 201806L [C++2a]
__cpp_lib_nonmember_container_access 201411L [C++17]
@@ -111,8 +111,8 @@
# ifndef __cpp_lib_erase_if
# error "__cpp_lib_erase_if should be defined in c++2a"
# endif
-# if __cpp_lib_erase_if != 201811L
-# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# if __cpp_lib_erase_if != 202002L
+# error "__cpp_lib_erase_if should have the value 202002L in c++2a"
# endif
# ifndef __cpp_lib_incomplete_container_elements
Index: libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.pass.cpp
===================================================================
--- libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.pass.cpp
+++ libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.pass.cpp
@@ -15,7 +15,7 @@
/* Constant Value
__cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
- __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_erase_if 202002L [C++2a]
__cpp_lib_nonmember_container_access 201411L [C++17]
*/
@@ -82,8 +82,8 @@
# ifndef __cpp_lib_erase_if
# error "__cpp_lib_erase_if should be defined in c++2a"
# endif
-# if __cpp_lib_erase_if != 201811L
-# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# if __cpp_lib_erase_if != 202002L
+# error "__cpp_lib_erase_if should have the value 202002L in c++2a"
# endif
# ifndef __cpp_lib_nonmember_container_access
Index: libcxx/test/std/containers/unord/unord.set/erase_if.pass.cpp
===================================================================
--- libcxx/test/std/containers/unord/unord.set/erase_if.pass.cpp
+++ libcxx/test/std/containers/unord/unord.set/erase_if.pass.cpp
@@ -10,7 +10,8 @@
//
// template
-// void erase_if(unorderd_set& c, Predicate pred);
+// typename unordered_set::size_type
+// erase_if(unordered_set& c, Predicate pred);
#include
@@ -30,17 +31,14 @@
}
template
-void
-test0(Init vals, Pred p, Init expected)
-{
- M s = make (vals);
- ASSERT_SAME_TYPE(void, decltype(std::erase_if(s, p)));
- std::erase_if(s, p);
- M e = make(expected);
- assert((std::is_permutation(s.begin(), s.end(), e.begin(), e.end())));
+void test0(Init vals, Pred p, Init expected, size_t expected_erased_count) {
+ M s = make(vals);
+ ASSERT_SAME_TYPE(typename M::size_type, decltype(std::erase_if(s, p)));
+ assert(expected_erased_count == std::erase_if(s, p));
+ M e = make(expected);
+ assert((std::is_permutation(s.begin(), s.end(), e.begin(), e.end())));
}
-
template
void test()
{
@@ -51,22 +49,22 @@
auto True = [](auto) { return true; };
auto False = [](auto) { return false; };
- test0({}, is1, {});
+ test0({}, is1, {}, 0);
- test0({1}, is1, {});
- test0({1}, is2, {1});
+ test0({1}, is1, {}, 1);
+ test0({1}, is2, {1}, 0);
- test0({1,2}, is1, {2});
- test0({1,2}, is2, {1});
- test0({1,2}, is3, {1,2});
+ test0({1, 2}, is1, {2}, 1);
+ test0({1, 2}, is2, {1}, 1);
+ test0({1, 2}, is3, {1, 2}, 0);
- test0({1,2,3}, is1, {2,3});
- test0({1,2,3}, is2, {1,3});
- test0({1,2,3}, is3, {1,2});
- test0({1,2,3}, is4, {1,2,3});
+ test0({1, 2, 3}, is1, {2, 3}, 1);
+ test0({1, 2, 3}, is2, {1, 3}, 1);
+ test0({1, 2, 3}, is3, {1, 2}, 1);
+ test0({1, 2, 3}, is4, {1, 2, 3}, 0);
- test0({1,2,3}, True, {});
- test0({1,2,3}, False, {1,2,3});
+ test0({1, 2, 3}, True, {}, 3);
+ test0({1, 2, 3}, False, {1, 2, 3}, 0);
}
int main(int, char**)
Index: libcxx/test/std/containers/unord/unord.multiset/erase_if.pass.cpp
===================================================================
--- libcxx/test/std/containers/unord/unord.multiset/erase_if.pass.cpp
+++ libcxx/test/std/containers/unord/unord.multiset/erase_if.pass.cpp
@@ -10,7 +10,8 @@
//
// template
-// void erase_if(unordered_multiset& c, Predicate pred);
+// typename unordered_multiset::size_type
+// erase_if(unordered_multiset& c, Predicate pred);
#include
@@ -30,14 +31,12 @@
}
template
-void
-test0(Init vals, Pred p, Init expected)
-{
- M s = make (vals);
- ASSERT_SAME_TYPE(void, decltype(std::erase_if(s, p)));
- std::erase_if(s, p);
- M e = make(expected);
- assert((std::is_permutation(s.begin(), s.end(), e.begin(), e.end())));
+void test0(Init vals, Pred p, Init expected, size_t expected_erased_count) {
+ M s = make(vals);
+ ASSERT_SAME_TYPE(typename M::size_type, decltype(std::erase_if(s, p)));
+ assert(expected_erased_count == std::erase_if(s, p));
+ M e = make(expected);
+ assert((std::is_permutation(s.begin(), s.end(), e.begin(), e.end())));
}
template
@@ -50,33 +49,33 @@
auto True = [](auto) { return true; };
auto False = [](auto) { return false; };
- test0({}, is1, {});
-
- test0({1}, is1, {});
- test0({1}, is2, {1});
-
- test0({1,2}, is1, {2});
- test0({1,2}, is2, {1});
- test0({1,2}, is3, {1,2});
- test0({1,1}, is1, {});
- test0({1,1}, is3, {1,1});
-
- test0({1,2,3}, is1, {2,3});
- test0({1,2,3}, is2, {1,3});
- test0({1,2,3}, is3, {1,2});
- test0({1,2,3}, is4, {1,2,3});
-
- test0({1,1,1}, is1, {});
- test0({1,1,1}, is2, {1,1,1});
- test0({1,1,2}, is1, {2});
- test0({1,1,2}, is2, {1,1});
- test0({1,1,2}, is3, {1,1,2});
- test0({1,2,2}, is1, {2,2});
- test0({1,2,2}, is2, {1});
- test0({1,2,2}, is3, {1,2,2});
-
- test0({1,2,3}, True, {});
- test0({1,2,3}, False, {1,2,3});
+ test0({}, is1, {}, 0);
+
+ test0({1}, is1, {}, 1);
+ test0({1}, is2, {1}, 0);
+
+ test0({1, 2}, is1, {2}, 1);
+ test0({1, 2}, is2, {1}, 1);
+ test0({1, 2}, is3, {1, 2}, 0);
+ test0({1, 1}, is1, {}, 2);
+ test0({1, 1}, is3, {1, 1}, 0);
+
+ test0({1, 2, 3}, is1, {2, 3}, 1);
+ test0({1, 2, 3}, is2, {1, 3}, 1);
+ test0({1, 2, 3}, is3, {1, 2}, 1);
+ test0({1, 2, 3}, is4, {1, 2, 3}, 0);
+
+ test0({1, 1, 1}, is1, {}, 3);
+ test0({1, 1, 1}, is2, {1, 1, 1}, 0);
+ test0({1, 1, 2}, is1, {2}, 2);
+ test0({1, 1, 2}, is2, {1, 1}, 1);
+ test0({1, 1, 2}, is3, {1, 1, 2}, 0);
+ test0({1, 2, 2}, is1, {2, 2}, 1);
+ test0({1, 2, 2}, is2, {1}, 2);
+ test0({1, 2, 2}, is3, {1, 2, 2}, 0);
+
+ test0({1, 2, 3}, True, {}, 3);
+ test0({1, 2, 3}, False, {1, 2, 3}, 0);
}
int main(int, char**)
Index: libcxx/test/std/containers/unord/unord.multimap/erase_if.pass.cpp
===================================================================
--- libcxx/test/std/containers/unord/unord.multimap/erase_if.pass.cpp
+++ libcxx/test/std/containers/unord/unord.multimap/erase_if.pass.cpp
@@ -10,7 +10,8 @@
//
// template
-// void erase_if(unordered_multimap& c, Predicate pred);
+// typename unordered_multimap::size_type
+// erase_if(unordered_multimap& c, Predicate pred);
#include
@@ -29,14 +30,12 @@
}
template
-void
-test0(Init vals, Pred p, Init expected)
-{
- M s = make (vals);
- ASSERT_SAME_TYPE(void, decltype(std::erase_if(s, p)));
- std::erase_if(s, p);
- M e = make(expected);
- assert((std::is_permutation(s.begin(), s.end(), e.begin(), e.end())));
+void test0(Init vals, Pred p, Init expected, size_t expected_erased_count) {
+ M s = make(vals);
+ ASSERT_SAME_TYPE(typename M::size_type, decltype(std::erase_if(s, p)));
+ assert(expected_erased_count == std::erase_if(s, p));
+ M e = make(expected);
+ assert((std::is_permutation(s.begin(), s.end(), e.begin(), e.end())));
}
template
@@ -49,33 +48,33 @@
auto True = [](auto) { return true; };
auto False = [](auto) { return false; };
- test0({}, is1, {});
-
- test0({1}, is1, {});
- test0({1}, is2, {1});
-
- test0({1,2}, is1, {2});
- test0({1,2}, is2, {1});
- test0({1,2}, is3, {1,2});
- test0({1,1}, is1, {});
- test0({1,1}, is3, {1,1});
-
- test0({1,2,3}, is1, {2,3});
- test0({1,2,3}, is2, {1,3});
- test0({1,2,3}, is3, {1,2});
- test0({1,2,3}, is4, {1,2,3});
-
- test0({1,1,1}, is1, {});
- test0({1,1,1}, is2, {1,1,1});
- test0({1,1,2}, is1, {2});
- test0({1,1,2}, is2, {1,1});
- test0({1,1,2}, is3, {1,1,2});
- test0({1,2,2}, is1, {2,2});
- test0({1,2,2}, is2, {1});
- test0({1,2,2}, is3, {1,2,2});
-
- test0({1,2,3}, True, {});
- test0({1,2,3}, False, {1,2,3});
+ test0({}, is1, {}, 0);
+
+ test0({1}, is1, {}, 1);
+ test0({1}, is2, {1}, 0);
+
+ test0({1, 2}, is1, {2}, 1);
+ test0({1, 2}, is2, {1}, 1);
+ test0({1, 2}, is3, {1, 2}, 0);
+ test0({1, 1}, is1, {}, 2);
+ test0({1, 1}, is3, {1, 1}, 0);
+
+ test0({1, 2, 3}, is1, {2, 3}, 1);
+ test0({1, 2, 3}, is2, {1, 3}, 1);
+ test0({1, 2, 3}, is3, {1, 2}, 1);
+ test0({1, 2, 3}, is4, {1, 2, 3}, 0);
+
+ test0({1, 1, 1}, is1, {}, 3);
+ test0({1, 1, 1}, is2, {1, 1, 1}, 0);
+ test0({1, 1, 2}, is1, {2}, 2);
+ test0({1, 1, 2}, is2, {1, 1}, 1);
+ test0({1, 1, 2}, is3, {1, 1, 2}, 0);
+ test0({1, 2, 2}, is1, {2, 2}, 1);
+ test0({1, 2, 2}, is2, {1}, 2);
+ test0({1, 2, 2}, is3, {1, 2, 2}, 0);
+
+ test0({1, 2, 3}, True, {}, 3);
+ test0({1, 2, 3}, False, {1, 2, 3}, 0);
}
int main(int, char**)
Index: libcxx/test/std/containers/unord/unord.map/erase_if.pass.cpp
===================================================================
--- libcxx/test/std/containers/unord/unord.map/erase_if.pass.cpp
+++ libcxx/test/std/containers/unord/unord.map/erase_if.pass.cpp
@@ -10,7 +10,8 @@
//
// template
-// void erase_if(unordered_map& c, Predicate pred);
+// typename unordered_map::size_type
+// erase_if(unordered_map& c, Predicate pred);
#include
@@ -29,14 +30,12 @@
}
template
-void
-test0(Init vals, Pred p, Init expected)
-{
- M s = make (vals);
- ASSERT_SAME_TYPE(void, decltype(std::erase_if(s, p)));
- std::erase_if(s, p);
- M e = make(expected);
- assert((std::is_permutation(s.begin(), s.end(), e.begin(), e.end())));
+void test0(Init vals, Pred p, Init expected, size_t expected_erased_count) {
+ M s = make(vals);
+ ASSERT_SAME_TYPE(typename M::size_type, decltype(std::erase_if(s, p)));
+ assert(expected_erased_count == std::erase_if(s, p));
+ M e = make(expected);
+ assert((std::is_permutation(s.begin(), s.end(), e.begin(), e.end())));
}
template
@@ -49,22 +48,22 @@
auto True = [](auto) { return true; };
auto False = [](auto) { return false; };
- test0({}, is1, {});
+ test0({}, is1, {}, 0);
- test0({1}, is1, {});
- test0({1}, is2, {1});
+ test0({1}, is1, {}, 1);
+ test0({1}, is2, {1}, 0);
- test0({1,2}, is1, {2});
- test0({1,2}, is2, {1});
- test0({1,2}, is3, {1,2});
+ test0({1, 2}, is1, {2}, 1);
+ test0({1, 2}, is2, {1}, 1);
+ test0({1, 2}, is3, {1, 2}, 0);
- test0({1,2,3}, is1, {2,3});
- test0({1,2,3}, is2, {1,3});
- test0({1,2,3}, is3, {1,2});
- test0({1,2,3}, is4, {1,2,3});
+ test0({1, 2, 3}, is1, {2, 3}, 1);
+ test0({1, 2, 3}, is2, {1, 3}, 1);
+ test0({1, 2, 3}, is3, {1, 2}, 1);
+ test0({1, 2, 3}, is4, {1, 2, 3}, 0);
- test0({1,2,3}, True, {});
- test0({1,2,3}, False, {1,2,3});
+ test0({1, 2, 3}, True, {}, 3);
+ test0({1, 2, 3}, False, {1, 2, 3}, 0);
}
int main(int, char**)
Index: libcxx/test/std/containers/sequences/vector/vector.erasure/erase_if.pass.cpp
===================================================================
--- libcxx/test/std/containers/sequences/vector/vector.erasure/erase_if.pass.cpp
+++ libcxx/test/std/containers/sequences/vector/vector.erasure/erase_if.pass.cpp
@@ -10,7 +10,8 @@
//
// template
-// void erase_if(vector& c, Predicate pred);
+// typename vector::size_type
+// erase_if(vector& c, Predicate pred);
#include
@@ -19,12 +20,10 @@
#include "min_allocator.h"
template
-void
-test0(S s, Pred p, S expected)
-{
- ASSERT_SAME_TYPE(void, decltype(std::erase_if(s, p)));
- std::erase_if(s, p);
- assert(s == expected);
+void test0(S s, Pred p, S expected, size_t expected_erased_count) {
+ ASSERT_SAME_TYPE(typename S::size_type, decltype(std::erase_if(s, p)));
+ assert(expected_erased_count == std::erase_if(s, p));
+ assert(s == expected);
}
template
@@ -37,33 +36,33 @@
auto True = [](auto) { return true; };
auto False = [](auto) { return false; };
- test0(S(), is1, S());
+ test0(S(), is1, S(), 0);
- test0(S({1}), is1, S());
- test0(S({1}), is2, S({1}));
+ test0(S({1}), is1, S(), 1);
+ test0(S({1}), is2, S({1}), 0);
- test0(S({1,2}), is1, S({2}));
- test0(S({1,2}), is2, S({1}));
- test0(S({1,2}), is3, S({1,2}));
- test0(S({1,1}), is1, S());
- test0(S({1,1}), is3, S({1,1}));
+ test0(S({1, 2}), is1, S({2}), 1);
+ test0(S({1, 2}), is2, S({1}), 1);
+ test0(S({1, 2}), is3, S({1, 2}), 0);
+ test0(S({1, 1}), is1, S(), 2);
+ test0(S({1, 1}), is3, S({1, 1}), 0);
- test0(S({1,2,3}), is1, S({2,3}));
- test0(S({1,2,3}), is2, S({1,3}));
- test0(S({1,2,3}), is3, S({1,2}));
- test0(S({1,2,3}), is4, S({1,2,3}));
+ test0(S({1, 2, 3}), is1, S({2, 3}), 1);
+ test0(S({1, 2, 3}), is2, S({1, 3}), 1);
+ test0(S({1, 2, 3}), is3, S({1, 2}), 1);
+ test0(S({1, 2, 3}), is4, S({1, 2, 3}), 0);
- test0(S({1,1,1}), is1, S());
- test0(S({1,1,1}), is2, S({1,1,1}));
- test0(S({1,1,2}), is1, S({2}));
- test0(S({1,1,2}), is2, S({1,1}));
- test0(S({1,1,2}), is3, S({1,1,2}));
- test0(S({1,2,2}), is1, S({2,2}));
- test0(S({1,2,2}), is2, S({1}));
- test0(S({1,2,2}), is3, S({1,2,2}));
+ test0(S({1, 1, 1}), is1, S(), 3);
+ test0(S({1, 1, 1}), is2, S({1, 1, 1}), 0);
+ test0(S({1, 1, 2}), is1, S({2}), 2);
+ test0(S({1, 1, 2}), is2, S({1, 1}), 1);
+ test0(S({1, 1, 2}), is3, S({1, 1, 2}), 0);
+ test0(S({1, 2, 2}), is1, S({2, 2}), 1);
+ test0(S({1, 2, 2}), is2, S({1}), 2);
+ test0(S({1, 2, 2}), is3, S({1, 2, 2}), 0);
- test0(S({1,2,3}), True, S());
- test0(S({1,2,3}), False, S({1,2,3}));
+ test0(S({1, 2, 3}), True, S(), 3);
+ test0(S({1, 2, 3}), False, S({1, 2, 3}), 0);
}
int main(int, char**)
Index: libcxx/test/std/containers/sequences/vector/vector.erasure/erase.pass.cpp
===================================================================
--- libcxx/test/std/containers/sequences/vector/vector.erasure/erase.pass.cpp
+++ libcxx/test/std/containers/sequences/vector/vector.erasure/erase.pass.cpp
@@ -10,8 +10,8 @@
//
// template
-// void erase(vector& c, const U& value);
-
+// typename vector::size_type
+// erase(vector& c, const U& value);
#include
#include
@@ -21,49 +21,47 @@
#include "min_allocator.h"
template
-void
-test0(S s, U val, S expected)
-{
- ASSERT_SAME_TYPE(void, decltype(std::erase(s, val)));
- std::erase(s, val);
- assert(s == expected);
+void test0(S s, U val, S expected, size_t expected_erased_count) {
+ ASSERT_SAME_TYPE(typename S::size_type, decltype(std::erase(s, val)));
+ assert(expected_erased_count == std::erase(s, val));
+ assert(s == expected);
}
template
void test()
{
- test0(S(), 1, S());
-
- test0(S({1}), 1, S());
- test0(S({1}), 2, S({1}));
-
- test0(S({1,2}), 1, S({2}));
- test0(S({1,2}), 2, S({1}));
- test0(S({1,2}), 3, S({1,2}));
- test0(S({1,1}), 1, S());
- test0(S({1,1}), 3, S({1,1}));
-
- test0(S({1,2,3}), 1, S({2,3}));
- test0(S({1,2,3}), 2, S({1,3}));
- test0(S({1,2,3}), 3, S({1,2}));
- test0(S({1,2,3}), 4, S({1,2,3}));
-
- test0(S({1,1,1}), 1, S());
- test0(S({1,1,1}), 2, S({1,1,1}));
- test0(S({1,1,2}), 1, S({2}));
- test0(S({1,1,2}), 2, S({1,1}));
- test0(S({1,1,2}), 3, S({1,1,2}));
- test0(S({1,2,2}), 1, S({2,2}));
- test0(S({1,2,2}), 2, S({1}));
- test0(S({1,2,2}), 3, S({1,2,2}));
-
-// Test cross-type erasure
- using opt = std::optional;
- test0(S({1,2,1}), opt(), S({1,2,1}));
- test0(S({1,2,1}), opt(1), S({2}));
- test0(S({1,2,1}), opt(2), S({1,1}));
- test0(S({1,2,1}), opt(3), S({1,2,1}));
+ test0(S(), 1, S(), 0);
+
+ test0(S({1}), 1, S(), 1);
+ test0(S({1}), 2, S({1}), 0);
+
+ test0(S({1, 2}), 1, S({2}), 1);
+ test0(S({1, 2}), 2, S({1}), 1);
+ test0(S({1, 2}), 3, S({1, 2}), 0);
+ test0(S({1, 1}), 1, S(), 2);
+ test0(S({1, 1}), 3, S({1, 1}), 0);
+
+ test0(S({1, 2, 3}), 1, S({2, 3}), 1);
+ test0(S({1, 2, 3}), 2, S({1, 3}), 1);
+ test0(S({1, 2, 3}), 3, S({1, 2}), 1);
+ test0(S({1, 2, 3}), 4, S({1, 2, 3}), 0);
+
+ test0(S({1, 1, 1}), 1, S(), 3);
+ test0(S({1, 1, 1}), 2, S({1, 1, 1}), 0);
+ test0(S({1, 1, 2}), 1, S({2}), 2);
+ test0(S({1, 1, 2}), 2, S({1, 1}), 1);
+ test0(S({1, 1, 2}), 3, S({1, 1, 2}), 0);
+ test0(S({1, 2, 2}), 1, S({2, 2}), 1);
+ test0(S({1, 2, 2}), 2, S({1}), 2);
+ test0(S({1, 2, 2}), 3, S({1, 2, 2}), 0);
+
+ // Test cross-type erasure
+ using opt = std::optional;
+ test0(S({1, 2, 1}), opt(), S({1, 2, 1}), 0);
+ test0(S({1, 2, 1}), opt(1), S({2}), 2);
+ test0(S({1, 2, 1}), opt(2), S({1, 1}), 1);
+ test0(S({1, 2, 1}), opt(3), S({1, 2, 1}), 0);
}
int main(int, char**)
Index: libcxx/test/std/containers/sequences/list/list.erasure/erase_if.pass.cpp
===================================================================
--- libcxx/test/std/containers/sequences/list/list.erasure/erase_if.pass.cpp
+++ libcxx/test/std/containers/sequences/list/list.erasure/erase_if.pass.cpp
@@ -10,7 +10,8 @@
//
// template
-// void erase_if(list& c, Predicate pred);
+// typename list::size_type
+// erase_if(list& c, Predicate pred);
#include
@@ -19,12 +20,10 @@
#include "min_allocator.h"
template
-void
-test0(S s, Pred p, S expected)
-{
- ASSERT_SAME_TYPE(void, decltype(std::erase_if(s, p)));
- std::erase_if(s, p);
- assert(s == expected);
+void test0(S s, Pred p, S expected, size_t expected_erased_count) {
+ ASSERT_SAME_TYPE(typename S::size_type, decltype(std::erase_if(s, p)));
+ assert(expected_erased_count == std::erase_if(s, p));
+ assert(s == expected);
}
template
@@ -37,33 +36,33 @@
auto True = [](auto) { return true; };
auto False = [](auto) { return false; };
- test0(S(), is1, S());
+ test0(S(), is1, S(), 0);
- test0(S({1}), is1, S());
- test0(S({1}), is2, S({1}));
+ test0(S({1}), is1, S(), 1);
+ test0(S({1}), is2, S({1}), 0);
- test0(S({1,2}), is1, S({2}));
- test0(S({1,2}), is2, S({1}));
- test0(S({1,2}), is3, S({1,2}));
- test0(S({1,1}), is1, S());
- test0(S({1,1}), is3, S({1,1}));
+ test0(S({1, 2}), is1, S({2}), 1);
+ test0(S({1, 2}), is2, S({1}), 1);
+ test0(S({1, 2}), is3, S({1, 2}), 0);
+ test0(S({1, 1}), is1, S(), 2);
+ test0(S({1, 1}), is3, S({1, 1}), 0);
- test0(S({1,2,3}), is1, S({2,3}));
- test0(S({1,2,3}), is2, S({1,3}));
- test0(S({1,2,3}), is3, S({1,2}));
- test0(S({1,2,3}), is4, S({1,2,3}));
+ test0(S({1, 2, 3}), is1, S({2, 3}), 1);
+ test0(S({1, 2, 3}), is2, S({1, 3}), 1);
+ test0(S({1, 2, 3}), is3, S({1, 2}), 1);
+ test0(S({1, 2, 3}), is4, S({1, 2, 3}), 0);
- test0(S({1,1,1}), is1, S());
- test0(S({1,1,1}), is2, S({1,1,1}));
- test0(S({1,1,2}), is1, S({2}));
- test0(S({1,1,2}), is2, S({1,1}));
- test0(S({1,1,2}), is3, S({1,1,2}));
- test0(S({1,2,2}), is1, S({2,2}));
- test0(S({1,2,2}), is2, S({1}));
- test0(S({1,2,2}), is3, S({1,2,2}));
+ test0(S({1, 1, 1}), is1, S(), 3);
+ test0(S({1, 1, 1}), is2, S({1, 1, 1}), 0);
+ test0(S({1, 1, 2}), is1, S({2}), 2);
+ test0(S({1, 1, 2}), is2, S({1, 1}), 1);
+ test0(S({1, 1, 2}), is3, S({1, 1, 2}), 0);
+ test0(S({1, 2, 2}), is1, S({2, 2}), 1);
+ test0(S({1, 2, 2}), is2, S({1}), 2);
+ test0(S({1, 2, 2}), is3, S({1, 2, 2}), 0);
- test0(S({1,2,3}), True, S());
- test0(S({1,2,3}), False, S({1,2,3}));
+ test0(S({1, 2, 3}), True, S(), 3);
+ test0(S({1, 2, 3}), False, S({1, 2, 3}), 0);
}
int main(int, char**)
Index: libcxx/test/std/containers/sequences/list/list.erasure/erase.pass.cpp
===================================================================
--- libcxx/test/std/containers/sequences/list/list.erasure/erase.pass.cpp
+++ libcxx/test/std/containers/sequences/list/list.erasure/erase.pass.cpp
@@ -10,8 +10,8 @@
//
// template
-// void erase(list& c, const U& value);
-
+// typename list::size_type
+// erase(list& c, const U& value);
#include
#include
@@ -21,49 +21,46 @@
#include "min_allocator.h"
template
-void
-test0(S s, U val, S expected)
-{
- ASSERT_SAME_TYPE(void, decltype(std::erase(s, val)));
- std::erase(s, val);
- assert(s == expected);
+void test0(S s, U val, S expected, size_t expected_erased_count) {
+ ASSERT_SAME_TYPE(typename S::size_type, decltype(std::erase(s, val)));
+ assert(expected_erased_count == std::erase(s, val));
+ assert(s == expected);
}
template
void test()
{
-
- test0(S(), 1, S());
-
- test0(S({1}), 1, S());
- test0(S({1}), 2, S({1}));
-
- test0(S({1,2}), 1, S({2}));
- test0(S({1,2}), 2, S({1}));
- test0(S({1,2}), 3, S({1,2}));
- test0(S({1,1}), 1, S());
- test0(S({1,1}), 3, S({1,1}));
-
- test0(S({1,2,3}), 1, S({2,3}));
- test0(S({1,2,3}), 2, S({1,3}));
- test0(S({1,2,3}), 3, S({1,2}));
- test0(S({1,2,3}), 4, S({1,2,3}));
-
- test0(S({1,1,1}), 1, S());
- test0(S({1,1,1}), 2, S({1,1,1}));
- test0(S({1,1,2}), 1, S({2}));
- test0(S({1,1,2}), 2, S({1,1}));
- test0(S({1,1,2}), 3, S({1,1,2}));
- test0(S({1,2,2}), 1, S({2,2}));
- test0(S({1,2,2}), 2, S({1}));
- test0(S({1,2,2}), 3, S({1,2,2}));
-
-// Test cross-type erasure
- using opt = std::optional;
- test0(S({1,2,1}), opt(), S({1,2,1}));
- test0(S({1,2,1}), opt(1), S({2}));
- test0(S({1,2,1}), opt(2), S({1,1}));
- test0(S({1,2,1}), opt(3), S({1,2,1}));
+ test0(S(), 1, S(), 0);
+
+ test0(S({1}), 1, S(), 1);
+ test0(S({1}), 2, S({1}), 0);
+
+ test0(S({1, 2}), 1, S({2}), 1);
+ test0(S({1, 2}), 2, S({1}), 1);
+ test0(S({1, 2}), 3, S({1, 2}), 0);
+ test0(S({1, 1}), 1, S(), 2);
+ test0(S({1, 1}), 3, S({1, 1}), 0);
+
+ test0(S({1, 2, 3}), 1, S({2, 3}), 1);
+ test0(S({1, 2, 3}), 2, S({1, 3}), 1);
+ test0(S({1, 2, 3}), 3, S({1, 2}), 1);
+ test0(S({1, 2, 3}), 4, S({1, 2, 3}), 0);
+
+ test0(S({1, 1, 1}), 1, S(), 3);
+ test0(S({1, 1, 1}), 2, S({1, 1, 1}), 0);
+ test0(S({1, 1, 2}), 1, S({2}), 2);
+ test0(S({1, 1, 2}), 2, S({1, 1}), 1);
+ test0(S({1, 1, 2}), 3, S({1, 1, 2}), 0);
+ test0(S({1, 2, 2}), 1, S({2, 2}), 1);
+ test0(S({1, 2, 2}), 2, S({1}), 2);
+ test0(S({1, 2, 2}), 3, S({1, 2, 2}), 0);
+
+ // Test cross-type erasure
+ using opt = std::optional;
+ test0(S({1, 2, 1}), opt(), S({1, 2, 1}), 0);
+ test0(S({1, 2, 1}), opt(1), S({2}), 2);
+ test0(S({1, 2, 1}), opt(2), S({1, 1}), 1);
+ test0(S({1, 2, 1}), opt(3), S({1, 2, 1}), 0);
}
int main(int, char**)
Index: libcxx/test/std/containers/sequences/forwardlist/forwardlist.erasure/erase_if.pass.cpp
===================================================================
--- libcxx/test/std/containers/sequences/forwardlist/forwardlist.erasure/erase_if.pass.cpp
+++ libcxx/test/std/containers/sequences/forwardlist/forwardlist.erasure/erase_if.pass.cpp
@@ -10,7 +10,8 @@
//
// template
-// void erase_if(forward_list& c, Predicate pred);
+// typename forward_list::size_type
+// erase_if(forward_list& c, Predicate pred);
#include
@@ -19,12 +20,10 @@
#include "min_allocator.h"
template
-void
-test0(S s, Pred p, S expected)
-{
- ASSERT_SAME_TYPE(void, decltype(std::erase_if(s, p)));
- std::erase_if(s, p);
- assert(s == expected);
+void test0(S s, Pred p, S expected, size_t expected_erased_count) {
+ ASSERT_SAME_TYPE(typename S::size_type, decltype(std::erase_if(s, p)));
+ assert(expected_erased_count == std::erase_if(s, p));
+ assert(s == expected);
}
template
@@ -37,33 +36,33 @@
auto True = [](auto) { return true; };
auto False = [](auto) { return false; };
- test0(S(), is1, S());
+ test0(S(), is1, S(), 0);
- test0(S({1}), is1, S());
- test0(S({1}), is2, S({1}));
+ test0(S({1}), is1, S(), 1);
+ test0(S({1}), is2, S({1}), 0);
- test0(S({1,2}), is1, S({2}));
- test0(S({1,2}), is2, S({1}));
- test0(S({1,2}), is3, S({1,2}));
- test0(S({1,1}), is1, S());
- test0(S({1,1}), is3, S({1,1}));
+ test0(S({1, 2}), is1, S({2}), 1);
+ test0(S({1, 2}), is2, S({1}), 1);
+ test0(S({1, 2}), is3, S({1, 2}), 0);
+ test0(S({1, 1}), is1, S(), 2);
+ test0(S({1, 1}), is3, S({1, 1}), 0);
- test0(S({1,2,3}), is1, S({2,3}));
- test0(S({1,2,3}), is2, S({1,3}));
- test0(S({1,2,3}), is3, S({1,2}));
- test0(S({1,2,3}), is4, S({1,2,3}));
+ test0(S({1, 2, 3}), is1, S({2, 3}), 1);
+ test0(S({1, 2, 3}), is2, S({1, 3}), 1);
+ test0(S({1, 2, 3}), is3, S({1, 2}), 1);
+ test0(S({1, 2, 3}), is4, S({1, 2, 3}), 0);
- test0(S({1,1,1}), is1, S());
- test0(S({1,1,1}), is2, S({1,1,1}));
- test0(S({1,1,2}), is1, S({2}));
- test0(S({1,1,2}), is2, S({1,1}));
- test0(S({1,1,2}), is3, S({1,1,2}));
- test0(S({1,2,2}), is1, S({2,2}));
- test0(S({1,2,2}), is2, S({1}));
- test0(S({1,2,2}), is3, S({1,2,2}));
+ test0(S({1, 1, 1}), is1, S(), 3);
+ test0(S({1, 1, 1}), is2, S({1, 1, 1}), 0);
+ test0(S({1, 1, 2}), is1, S({2}), 2);
+ test0(S({1, 1, 2}), is2, S({1, 1}), 1);
+ test0(S({1, 1, 2}), is3, S({1, 1, 2}), 0);
+ test0(S({1, 2, 2}), is1, S({2, 2}), 1);
+ test0(S({1, 2, 2}), is2, S({1}), 2);
+ test0(S({1, 2, 2}), is3, S({1, 2, 2}), 0);
- test0(S({1,2,3}), True, S());
- test0(S({1,2,3}), False, S({1,2,3}));
+ test0(S({1, 2, 3}), True, S(), 3);
+ test0(S({1, 2, 3}), False, S({1, 2, 3}), 0);
}
int main(int, char**)
Index: libcxx/test/std/containers/sequences/forwardlist/forwardlist.erasure/erase.pass.cpp
===================================================================
--- libcxx/test/std/containers/sequences/forwardlist/forwardlist.erasure/erase.pass.cpp
+++ libcxx/test/std/containers/sequences/forwardlist/forwardlist.erasure/erase.pass.cpp
@@ -10,8 +10,8 @@
//
// template
-// void erase(forward_list& c, const U& value);
-
+// typename forward_list::size_type
+// erase(forward_list