From a2869936fc3f57f7052b1042f726f2d60e3c7fc6 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 15 Mar 2024 22:49:06 -0700 Subject: [PATCH] Delete `std::experimental::erase/erase_if` (#4470) --- stl/CMakeLists.txt | 9 -- stl/inc/__msvc_all_public_headers.hpp | 9 -- stl/inc/experimental/deque | 44 ------- stl/inc/experimental/forward_list | 44 ------- stl/inc/experimental/list | 44 ------- stl/inc/experimental/map | 44 ------- stl/inc/experimental/set | 44 ------- stl/inc/experimental/string | 44 ------- stl/inc/experimental/unordered_map | 46 ------- stl/inc/experimental/unordered_set | 45 ------- stl/inc/experimental/vector | 44 ------- stl/inc/yvals_core.h | 12 +- .../test.cpp | 120 ++---------------- .../test.compile.pass.cpp | 28 ++-- .../test.compile.pass.cpp | 2 - .../include_each_header_alone_matrix.lst | 9 -- 16 files changed, 20 insertions(+), 568 deletions(-) delete mode 100644 stl/inc/experimental/deque delete mode 100644 stl/inc/experimental/forward_list delete mode 100644 stl/inc/experimental/list delete mode 100644 stl/inc/experimental/map delete mode 100644 stl/inc/experimental/set delete mode 100644 stl/inc/experimental/string delete mode 100644 stl/inc/experimental/unordered_map delete mode 100644 stl/inc/experimental/unordered_set delete mode 100644 stl/inc/experimental/vector diff --git a/stl/CMakeLists.txt b/stl/CMakeLists.txt index 8cf80c95d2..81f9fd6525 100644 --- a/stl/CMakeLists.txt +++ b/stl/CMakeLists.txt @@ -68,18 +68,9 @@ set(HEADERS ${CMAKE_CURRENT_LIST_DIR}/inc/execution ${CMAKE_CURRENT_LIST_DIR}/inc/expected ${CMAKE_CURRENT_LIST_DIR}/inc/experimental/coroutine - ${CMAKE_CURRENT_LIST_DIR}/inc/experimental/deque ${CMAKE_CURRENT_LIST_DIR}/inc/experimental/filesystem - ${CMAKE_CURRENT_LIST_DIR}/inc/experimental/forward_list ${CMAKE_CURRENT_LIST_DIR}/inc/experimental/generator - ${CMAKE_CURRENT_LIST_DIR}/inc/experimental/list - ${CMAKE_CURRENT_LIST_DIR}/inc/experimental/map ${CMAKE_CURRENT_LIST_DIR}/inc/experimental/resumable - ${CMAKE_CURRENT_LIST_DIR}/inc/experimental/set - ${CMAKE_CURRENT_LIST_DIR}/inc/experimental/string - ${CMAKE_CURRENT_LIST_DIR}/inc/experimental/unordered_map - ${CMAKE_CURRENT_LIST_DIR}/inc/experimental/unordered_set - ${CMAKE_CURRENT_LIST_DIR}/inc/experimental/vector ${CMAKE_CURRENT_LIST_DIR}/inc/filesystem ${CMAKE_CURRENT_LIST_DIR}/inc/format ${CMAKE_CURRENT_LIST_DIR}/inc/forward_list diff --git a/stl/inc/__msvc_all_public_headers.hpp b/stl/inc/__msvc_all_public_headers.hpp index 6e27cbbe74..ad3e8286d9 100644 --- a/stl/inc/__msvc_all_public_headers.hpp +++ b/stl/inc/__msvc_all_public_headers.hpp @@ -155,16 +155,7 @@ #include // Non-Core Experimental Headers -#include #include -#include -#include -#include -#include -#include -#include -#include -#include #endif // !defined(_CORE_HEADERS_ONLY) diff --git a/stl/inc/experimental/deque b/stl/inc/experimental/deque deleted file mode 100644 index 0ac00fb20a..0000000000 --- a/stl/inc/experimental/deque +++ /dev/null @@ -1,44 +0,0 @@ -// deque experimental header - -// Copyright (c) Microsoft Corporation. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -#ifndef _EXPERIMENTAL_DEQUE_ -#define _EXPERIMENTAL_DEQUE_ -#include -#if _STL_COMPILER_PREPROCESSOR - -#include - -#pragma pack(push, _CRT_PACKING) -#pragma warning(push, _STL_WARNING_LEVEL) -#pragma warning(disable : _STL_DISABLED_WARNINGS) -_STL_DISABLE_CLANG_WARNINGS -#pragma push_macro("new") -#undef new - -_STD_BEGIN -namespace experimental { - inline namespace fundamentals_v2 { - - template - _DEPRECATE_EXPERIMENTAL_ERASE void erase_if(deque<_Ty, _Alloc>& _Cont, _Pr _Pred) { - _STD _Erase_remove_if(_Cont, _STD _Pass_fn(_Pred)); - } - - template - _DEPRECATE_EXPERIMENTAL_ERASE void erase(deque<_Ty, _Alloc>& _Cont, const _Uty& _Val) { - _STD _Erase_remove(_Cont, _Val); - } - - } // namespace fundamentals_v2 -} // namespace experimental -_STD_END - -#pragma pop_macro("new") -_STL_RESTORE_CLANG_WARNINGS -#pragma warning(pop) -#pragma pack(pop) - -#endif // _STL_COMPILER_PREPROCESSOR -#endif // _EXPERIMENTAL_DEQUE_ diff --git a/stl/inc/experimental/forward_list b/stl/inc/experimental/forward_list deleted file mode 100644 index e9b2928121..0000000000 --- a/stl/inc/experimental/forward_list +++ /dev/null @@ -1,44 +0,0 @@ -// forward_list experimental header - -// Copyright (c) Microsoft Corporation. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -#ifndef _EXPERIMENTAL_FORWARD_LIST_ -#define _EXPERIMENTAL_FORWARD_LIST_ -#include -#if _STL_COMPILER_PREPROCESSOR - -#include - -#pragma pack(push, _CRT_PACKING) -#pragma warning(push, _STL_WARNING_LEVEL) -#pragma warning(disable : _STL_DISABLED_WARNINGS) -_STL_DISABLE_CLANG_WARNINGS -#pragma push_macro("new") -#undef new - -_STD_BEGIN -namespace experimental { - inline namespace fundamentals_v2 { - - template - _DEPRECATE_EXPERIMENTAL_ERASE void erase_if(forward_list<_Ty, _Alloc>& _Cont, _Pr _Pred) { - _Cont.remove_if(_STD _Pass_fn(_Pred)); - } - - template - _DEPRECATE_EXPERIMENTAL_ERASE void erase(forward_list<_Ty, _Alloc>& _Cont, const _Uty& _Val) { - _Cont.remove_if([&](_Ty& _Elem) { return _Elem == _Val; }); - } - - } // namespace fundamentals_v2 -} // namespace experimental -_STD_END - -#pragma pop_macro("new") -_STL_RESTORE_CLANG_WARNINGS -#pragma warning(pop) -#pragma pack(pop) - -#endif // _STL_COMPILER_PREPROCESSOR -#endif // _EXPERIMENTAL_FORWARD_LIST_ diff --git a/stl/inc/experimental/list b/stl/inc/experimental/list deleted file mode 100644 index 3119b602f2..0000000000 --- a/stl/inc/experimental/list +++ /dev/null @@ -1,44 +0,0 @@ -// list experimental header - -// Copyright (c) Microsoft Corporation. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -#ifndef _EXPERIMENTAL_LIST_ -#define _EXPERIMENTAL_LIST_ -#include -#if _STL_COMPILER_PREPROCESSOR - -#include - -#pragma pack(push, _CRT_PACKING) -#pragma warning(push, _STL_WARNING_LEVEL) -#pragma warning(disable : _STL_DISABLED_WARNINGS) -_STL_DISABLE_CLANG_WARNINGS -#pragma push_macro("new") -#undef new - -_STD_BEGIN -namespace experimental { - inline namespace fundamentals_v2 { - - template - _DEPRECATE_EXPERIMENTAL_ERASE void erase_if(list<_Ty, _Alloc>& _Cont, _Pr _Pred) { - _Cont.remove_if(_STD _Pass_fn(_Pred)); - } - - template - _DEPRECATE_EXPERIMENTAL_ERASE void erase(list<_Ty, _Alloc>& _Cont, const _Uty& _Val) { - _Cont.remove_if([&](_Ty& _Elem) { return _Elem == _Val; }); - } - - } // namespace fundamentals_v2 -} // namespace experimental -_STD_END - -#pragma pop_macro("new") -_STL_RESTORE_CLANG_WARNINGS -#pragma warning(pop) -#pragma pack(pop) - -#endif // _STL_COMPILER_PREPROCESSOR -#endif // _EXPERIMENTAL_LIST_ diff --git a/stl/inc/experimental/map b/stl/inc/experimental/map deleted file mode 100644 index a78b276267..0000000000 --- a/stl/inc/experimental/map +++ /dev/null @@ -1,44 +0,0 @@ -// map experimental header - -// Copyright (c) Microsoft Corporation. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -#ifndef _EXPERIMENTAL_MAP_ -#define _EXPERIMENTAL_MAP_ -#include -#if _STL_COMPILER_PREPROCESSOR - -#include - -#pragma pack(push, _CRT_PACKING) -#pragma warning(push, _STL_WARNING_LEVEL) -#pragma warning(disable : _STL_DISABLED_WARNINGS) -_STL_DISABLE_CLANG_WARNINGS -#pragma push_macro("new") -#undef new - -_STD_BEGIN -namespace experimental { - inline namespace fundamentals_v2 { - - template - _DEPRECATE_EXPERIMENTAL_ERASE void erase_if(map<_Kty, _Ty, _Keylt, _Alloc>& _Cont, _Pr _Pred) { - _STD _Erase_nodes_if(_Cont, _STD _Pass_fn(_Pred)); - } - - template - _DEPRECATE_EXPERIMENTAL_ERASE void erase_if(multimap<_Kty, _Ty, _Keylt, _Alloc>& _Cont, _Pr _Pred) { - _STD _Erase_nodes_if(_Cont, _STD _Pass_fn(_Pred)); - } - - } // namespace fundamentals_v2 -} // namespace experimental -_STD_END - -#pragma pop_macro("new") -_STL_RESTORE_CLANG_WARNINGS -#pragma warning(pop) -#pragma pack(pop) - -#endif // _STL_COMPILER_PREPROCESSOR -#endif // _EXPERIMENTAL_MAP_ diff --git a/stl/inc/experimental/set b/stl/inc/experimental/set deleted file mode 100644 index 000f68d17f..0000000000 --- a/stl/inc/experimental/set +++ /dev/null @@ -1,44 +0,0 @@ -// set experimental header - -// Copyright (c) Microsoft Corporation. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -#ifndef _EXPERIMENTAL_SET_ -#define _EXPERIMENTAL_SET_ -#include -#if _STL_COMPILER_PREPROCESSOR - -#include - -#pragma pack(push, _CRT_PACKING) -#pragma warning(push, _STL_WARNING_LEVEL) -#pragma warning(disable : _STL_DISABLED_WARNINGS) -_STL_DISABLE_CLANG_WARNINGS -#pragma push_macro("new") -#undef new - -_STD_BEGIN -namespace experimental { - inline namespace fundamentals_v2 { - - template - _DEPRECATE_EXPERIMENTAL_ERASE void erase_if(set<_Kty, _Keylt, _Alloc>& _Cont, _Pr _Pred) { - _STD _Erase_nodes_if(_Cont, _STD _Pass_fn(_Pred)); - } - - template - _DEPRECATE_EXPERIMENTAL_ERASE void erase_if(multiset<_Kty, _Keylt, _Alloc>& _Cont, _Pr _Pred) { - _STD _Erase_nodes_if(_Cont, _STD _Pass_fn(_Pred)); - } - - } // namespace fundamentals_v2 -} // namespace experimental -_STD_END - -#pragma pop_macro("new") -_STL_RESTORE_CLANG_WARNINGS -#pragma warning(pop) -#pragma pack(pop) - -#endif // _STL_COMPILER_PREPROCESSOR -#endif // _EXPERIMENTAL_SET_ diff --git a/stl/inc/experimental/string b/stl/inc/experimental/string deleted file mode 100644 index 2bd4e4f142..0000000000 --- a/stl/inc/experimental/string +++ /dev/null @@ -1,44 +0,0 @@ -// string experimental header - -// Copyright (c) Microsoft Corporation. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -#ifndef _EXPERIMENTAL_STRING_ -#define _EXPERIMENTAL_STRING_ -#include -#if _STL_COMPILER_PREPROCESSOR - -#include - -#pragma pack(push, _CRT_PACKING) -#pragma warning(push, _STL_WARNING_LEVEL) -#pragma warning(disable : _STL_DISABLED_WARNINGS) -_STL_DISABLE_CLANG_WARNINGS -#pragma push_macro("new") -#undef new - -_STD_BEGIN -namespace experimental { - inline namespace fundamentals_v2 { - - template - _DEPRECATE_EXPERIMENTAL_ERASE void erase_if(basic_string<_Elem, _Traits, _Alloc>& _Cont, _Pr _Pred) { - _STD _Erase_remove_if(_Cont, _STD _Pass_fn(_Pred)); - } - - template - _DEPRECATE_EXPERIMENTAL_ERASE void erase(basic_string<_Elem, _Traits, _Alloc>& _Cont, const _Uty& _Val) { - _STD _Erase_remove(_Cont, _Val); - } - - } // namespace fundamentals_v2 -} // namespace experimental -_STD_END - -#pragma pop_macro("new") -_STL_RESTORE_CLANG_WARNINGS -#pragma warning(pop) -#pragma pack(pop) - -#endif // _STL_COMPILER_PREPROCESSOR -#endif // _EXPERIMENTAL_STRING_ diff --git a/stl/inc/experimental/unordered_map b/stl/inc/experimental/unordered_map deleted file mode 100644 index 150495450e..0000000000 --- a/stl/inc/experimental/unordered_map +++ /dev/null @@ -1,46 +0,0 @@ -// unordered_map experimental header - -// Copyright (c) Microsoft Corporation. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -#ifndef _EXPERIMENTAL_UNORDERED_MAP_ -#define _EXPERIMENTAL_UNORDERED_MAP_ -#include -#if _STL_COMPILER_PREPROCESSOR - -#include - -#pragma pack(push, _CRT_PACKING) -#pragma warning(push, _STL_WARNING_LEVEL) -#pragma warning(disable : _STL_DISABLED_WARNINGS) -_STL_DISABLE_CLANG_WARNINGS -#pragma push_macro("new") -#undef new - -_STD_BEGIN -namespace experimental { - inline namespace fundamentals_v2 { - - template - _DEPRECATE_EXPERIMENTAL_ERASE void erase_if( - unordered_map<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>& _Cont, _Pr _Pred) { - _STD _Erase_nodes_if(_Cont, _STD _Pass_fn(_Pred)); - } - - template - _DEPRECATE_EXPERIMENTAL_ERASE void erase_if( - unordered_multimap<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>& _Cont, _Pr _Pred) { - _STD _Erase_nodes_if(_Cont, _STD _Pass_fn(_Pred)); - } - - } // namespace fundamentals_v2 -} // namespace experimental -_STD_END - -#pragma pop_macro("new") -_STL_RESTORE_CLANG_WARNINGS -#pragma warning(pop) -#pragma pack(pop) - -#endif // _STL_COMPILER_PREPROCESSOR -#endif // _EXPERIMENTAL_UNORDERED_MAP_ diff --git a/stl/inc/experimental/unordered_set b/stl/inc/experimental/unordered_set deleted file mode 100644 index 551a0a9c8f..0000000000 --- a/stl/inc/experimental/unordered_set +++ /dev/null @@ -1,45 +0,0 @@ -// unordered_set experimental header - -// Copyright (c) Microsoft Corporation. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -#ifndef _EXPERIMENTAL_UNORDERED_SET_ -#define _EXPERIMENTAL_UNORDERED_SET_ -#include -#if _STL_COMPILER_PREPROCESSOR - -#include - -#pragma pack(push, _CRT_PACKING) -#pragma warning(push, _STL_WARNING_LEVEL) -#pragma warning(disable : _STL_DISABLED_WARNINGS) -_STL_DISABLE_CLANG_WARNINGS -#pragma push_macro("new") -#undef new - -_STD_BEGIN -namespace experimental { - inline namespace fundamentals_v2 { - - template - _DEPRECATE_EXPERIMENTAL_ERASE void erase_if(unordered_set<_Kty, _Hasher, _Keyeq, _Alloc>& _Cont, _Pr _Pred) { - _STD _Erase_nodes_if(_Cont, _STD _Pass_fn(_Pred)); - } - - template - _DEPRECATE_EXPERIMENTAL_ERASE void erase_if( - unordered_multiset<_Kty, _Hasher, _Keyeq, _Alloc>& _Cont, _Pr _Pred) { - _STD _Erase_nodes_if(_Cont, _STD _Pass_fn(_Pred)); - } - - } // namespace fundamentals_v2 -} // namespace experimental -_STD_END - -#pragma pop_macro("new") -_STL_RESTORE_CLANG_WARNINGS -#pragma warning(pop) -#pragma pack(pop) - -#endif // _STL_COMPILER_PREPROCESSOR -#endif // _EXPERIMENTAL_UNORDERED_SET_ diff --git a/stl/inc/experimental/vector b/stl/inc/experimental/vector deleted file mode 100644 index f95823a6f8..0000000000 --- a/stl/inc/experimental/vector +++ /dev/null @@ -1,44 +0,0 @@ -// vector experimental header - -// Copyright (c) Microsoft Corporation. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -#ifndef _EXPERIMENTAL_VECTOR_ -#define _EXPERIMENTAL_VECTOR_ -#include -#if _STL_COMPILER_PREPROCESSOR - -#include - -#pragma pack(push, _CRT_PACKING) -#pragma warning(push, _STL_WARNING_LEVEL) -#pragma warning(disable : _STL_DISABLED_WARNINGS) -_STL_DISABLE_CLANG_WARNINGS -#pragma push_macro("new") -#undef new - -_STD_BEGIN -namespace experimental { - inline namespace fundamentals_v2 { - - template - _DEPRECATE_EXPERIMENTAL_ERASE void erase_if(vector<_Ty, _Alloc>& _Cont, _Pr _Pred) { - _STD _Erase_remove_if(_Cont, _STD _Pass_fn(_Pred)); - } - - template - _DEPRECATE_EXPERIMENTAL_ERASE void erase(vector<_Ty, _Alloc>& _Cont, const _Uty& _Val) { - _STD _Erase_remove(_Cont, _Val); - } - - } // namespace fundamentals_v2 -} // namespace experimental -_STD_END - -#pragma pop_macro("new") -_STL_RESTORE_CLANG_WARNINGS -#pragma warning(pop) -#pragma pack(pop) - -#endif // _STL_COMPILER_PREPROCESSOR -#endif // _EXPERIMENTAL_VECTOR_ diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index 21ddc88f6d..daceb8f32d 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -1324,15 +1324,8 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect #define _CXX20_DEPRECATE_IS_POD #endif // ^^^ warning disabled ^^^ -#if _HAS_CXX20 && !defined(_SILENCE_EXPERIMENTAL_ERASE_DEPRECATION_WARNING) -#define _DEPRECATE_EXPERIMENTAL_ERASE \ - [[deprecated("warning STL4026: " \ - "std::experimental::erase() and std::experimental::erase_if() are deprecated by Microsoft and will " \ - "be REMOVED. They are superseded by std::erase() and std::erase_if(). " \ - "You can define _SILENCE_EXPERIMENTAL_ERASE_DEPRECATION_WARNING to suppress this warning.")]] -#else // ^^^ warning enabled / warning disabled vvv -#define _DEPRECATE_EXPERIMENTAL_ERASE -#endif // ^^^ warning disabled ^^^ +// STL4026 was +// "std::experimental::erase() and std::experimental::erase_if() are deprecated by Microsoft and will be REMOVED." // P0768R1 [depr.relops] #if _HAS_CXX20 && !defined(_SILENCE_CXX20_REL_OPS_DEPRECATION_WARNING) \ @@ -1897,7 +1890,6 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect #define __cpp_lib_variant 202102L // P2162R2 Inheriting From variant #endif -#define __cpp_lib_experimental_erase_if 201411L #define __cpp_lib_experimental_filesystem 201406L #ifdef _RTC_CONVERSION_CHECKS_ENABLED diff --git a/tests/std/tests/Dev11_0000000_user_defined_literals/test.cpp b/tests/std/tests/Dev11_0000000_user_defined_literals/test.cpp index aea1fb6530..de11548135 100644 --- a/tests/std/tests/Dev11_0000000_user_defined_literals/test.cpp +++ b/tests/std/tests/Dev11_0000000_user_defined_literals/test.cpp @@ -4,7 +4,6 @@ #define _HAS_DEPRECATED_RAW_STORAGE_ITERATOR 1 #define _SILENCE_CXX17_RAW_STORAGE_ITERATOR_DEPRECATION_WARNING #define _SILENCE_CXX23_ALIGNED_UNION_DEPRECATION_WARNING -#define _SILENCE_EXPERIMENTAL_ERASE_DEPRECATION_WARNING #include #include @@ -13,15 +12,6 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include @@ -379,106 +369,18 @@ int main() { } - // N4273 Uniform Container Erasure +#if _HAS_CXX20 + // P0458R2 contains() For Ordered And Unordered Associative Containers { - // Note that the standard actually requires these to be copyable. As an extension, we want - // to ensure we don't copy them, because copying some functors (e.g. std::function) is comparatively - // expensive, and even for relatively cheap to copy function objects we care (somewhat) about debug - // mode perf. - struct no_copy { - no_copy() = default; - no_copy(const no_copy&) = delete; - no_copy(no_copy&&) = default; - no_copy& operator=(const no_copy&) = delete; - no_copy& operator=(no_copy&&) = delete; - }; - - struct is_vowel : no_copy { - bool operator()(const char c) const { - return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'; - } - }; - - std::string str1{"cute fluffy kittens"}; - std::experimental::erase_if(str1, is_vowel{}); - assert(str1 == "ct flffy kttns"); + std::map m = {{2, 20}, {4, 40}, {6, 60}}; + std::multimap mm = {{2, 20}, {4, 40}, {6, 60}}; + std::set s = {2, 4, 6}; + std::multiset ms = {2, 4, 6}; + std::unordered_map um = {{2, 20}, {4, 40}, {6, 60}}; + std::unordered_multimap umm = {{2, 20}, {4, 40}, {6, 60}}; + std::unordered_set us = {2, 4, 6}; + std::unordered_multiset ums = {2, 4, 6}; - std::string str2{"asynchronous beat"}; - std::experimental::erase(str2, 'a'); - assert(str2 == "synchronous bet"); - - struct is_odd : no_copy { - bool operator()(const int i) const { - return i % 2 != 0; - } - }; - - std::deque d{1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1}; - std::experimental::erase_if(d, is_odd{}); - assert((d == std::deque{2, 4, 6, 6, 4, 2})); - std::experimental::erase(d, 4); - assert((d == std::deque{2, 6, 6, 2})); - - std::vector v{1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1}; - std::experimental::erase_if(v, is_odd{}); - assert((v == std::vector{2, 4, 6, 6, 4, 2})); - std::experimental::erase(v, 4); - assert((v == std::vector{2, 6, 6, 2})); - - std::forward_list fl{1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1}; - std::experimental::erase_if(fl, is_odd{}); - assert((fl == std::forward_list{2, 4, 6, 6, 4, 2})); - std::experimental::erase(fl, 4); - assert((fl == std::forward_list{2, 6, 6, 2})); - - std::list l{1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1}; - std::experimental::erase_if(l, is_odd{}); - assert((l == std::list{2, 4, 6, 6, 4, 2})); - std::experimental::erase(l, 4); - assert((l == std::list{2, 6, 6, 2})); - - struct is_first_odd : no_copy { - bool operator()(const std::pair& p) const { - return p.first % 2 != 0; - } - }; - - std::map m{{1, 10}, {2, 20}, {3, 30}, {4, 40}, {5, 50}, {6, 60}, {7, 70}}; - std::experimental::erase_if(m, is_first_odd{}); - assert((m == std::map{{2, 20}, {4, 40}, {6, 60}})); - - std::multimap mm{{1, 10}, {2, 20}, {3, 30}, {4, 40}, {5, 50}, {6, 60}, {7, 70}}; - std::experimental::erase_if(mm, is_first_odd{}); - assert((mm == std::multimap{{2, 20}, {4, 40}, {6, 60}})); - - std::set s{1, 2, 3, 4, 5, 6, 7}; - std::experimental::erase_if(s, is_odd{}); - assert((s == std::set{2, 4, 6})); - - std::multiset ms{1, 2, 3, 4, 5, 6, 7}; - std::experimental::erase_if(ms, is_odd{}); - assert((ms == std::multiset{2, 4, 6})); - - // Note that unordered equality considers permutations. - - std::unordered_map um{{1, 10}, {2, 20}, {3, 30}, {4, 40}, {5, 50}, {6, 60}, {7, 70}}; - std::experimental::erase_if(um, is_first_odd{}); - assert((um == std::unordered_map{{2, 20}, {4, 40}, {6, 60}})); - - std::unordered_multimap umm{{1, 10}, {2, 20}, {3, 30}, {4, 40}, {5, 50}, {6, 60}, {7, 70}}; - std::experimental::erase_if(umm, is_first_odd{}); - assert((umm == std::unordered_multimap{{2, 20}, {4, 40}, {6, 60}})); - - std::unordered_set us{1, 2, 3, 4, 5, 6, 7}; - std::experimental::erase_if(us, is_odd{}); - assert((us == std::unordered_set{2, 4, 6})); - - std::unordered_multiset ums{1, 2, 3, 4, 5, 6, 7}; - std::experimental::erase_if(ums, is_odd{}); - assert((ums == std::unordered_multiset{2, 4, 6})); - -// P0458R2 contains() For Ordered And Unordered Associative Containers -#if _HAS_CXX20 assert(m.contains(2)); assert(mm.contains(4)); assert(s.contains(6)); @@ -532,10 +434,8 @@ int main() { assert(!const_umm.contains(5)); assert(!const_us.contains(1)); assert(!const_ums.contains(3)); -#endif // _HAS_CXX20 } -#if _HAS_CXX20 // P1209R0 erase_if(), erase() { // Note that the standard actually requires these to be copyable. As an extension, we want diff --git a/tests/std/tests/VSO_0000000_instantiate_containers/test.compile.pass.cpp b/tests/std/tests/VSO_0000000_instantiate_containers/test.compile.pass.cpp index 161d971c7b..c58b172e9a 100644 --- a/tests/std/tests/VSO_0000000_instantiate_containers/test.compile.pass.cpp +++ b/tests/std/tests/VSO_0000000_instantiate_containers/test.compile.pass.cpp @@ -2,22 +2,12 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #define _USE_NAMED_IDL_NAMESPACE 1 -#define _SILENCE_EXPERIMENTAL_ERASE_DEPRECATION_WARNING #define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS #include #include #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include @@ -285,25 +275,24 @@ void insert_with_iterator_test(T value) { template void erase_if_test(T value) { - auto pr1 = [](auto) { return false; }; - std::experimental::fundamentals_v2::erase_if(value, pr1); -#ifndef _M_CEE // TRANSITION, VSO-1659496 - std::experimental::fundamentals_v2::erase_if(value, validating_falsity{}); -#endif // ^^^ no workaround ^^^ #if _HAS_CXX20 + auto pr1 = [](auto) { return false; }; std::erase_if(value, pr1); #ifndef _M_CEE // TRANSITION, VSO-1659496 std::erase_if(value, validating_falsity{}); #endif // ^^^ no workaround ^^^ -#endif // _HAS_CXX20 +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv + (void) value; +#endif // ^^^ !_HAS_CXX20 ^^^ } template void erase_test(T value) { - std::experimental::fundamentals_v2::erase(value, static_cast(1)); #if _HAS_CXX20 std::erase(value, static_cast(1)); -#endif // _HAS_CXX20 +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv + (void) value; +#endif // ^^^ !_HAS_CXX20 ^^^ } template @@ -640,9 +629,8 @@ void vector_test() { vector_test_impl>(); erase_test(vector()); - vector vb; - std::experimental::fundamentals_v2::erase(vb, true); #if _HAS_CXX20 + vector vb; std::erase(vb, true); #endif // _HAS_CXX20 diff --git a/tests/std/tests/VSO_0157762_feature_test_macros/test.compile.pass.cpp b/tests/std/tests/VSO_0157762_feature_test_macros/test.compile.pass.cpp index db4e6c54a7..7145c29459 100644 --- a/tests/std/tests/VSO_0157762_feature_test_macros/test.compile.pass.cpp +++ b/tests/std/tests/VSO_0157762_feature_test_macros/test.compile.pass.cpp @@ -345,8 +345,6 @@ STATIC_ASSERT(__cpp_lib_expected == 202211L); #error __cpp_lib_expected is defined #endif -STATIC_ASSERT(__cpp_lib_experimental_erase_if == 201411L); - STATIC_ASSERT(__cpp_lib_experimental_filesystem == 201406L); #if _HAS_CXX17 diff --git a/tests/std/tests/include_each_header_alone_matrix.lst b/tests/std/tests/include_each_header_alone_matrix.lst index 4d07f7d8bb..2dfba42598 100644 --- a/tests/std/tests/include_each_header_alone_matrix.lst +++ b/tests/std/tests/include_each_header_alone_matrix.lst @@ -91,15 +91,6 @@ PM_CL="/DMEOW_HEADER=valarray" PM_CL="/DMEOW_HEADER=variant" PM_CL="/DMEOW_HEADER=vector" PM_CL="/DMEOW_HEADER=version" -PM_CL="/DMEOW_HEADER=experimental/deque" -PM_CL="/DMEOW_HEADER=experimental/forward_list" -PM_CL="/DMEOW_HEADER=experimental/list" -PM_CL="/DMEOW_HEADER=experimental/map" -PM_CL="/DMEOW_HEADER=experimental/set" -PM_CL="/DMEOW_HEADER=experimental/string" -PM_CL="/DMEOW_HEADER=experimental/unordered_map" -PM_CL="/DMEOW_HEADER=experimental/unordered_set" -PM_CL="/DMEOW_HEADER=experimental/vector" PM_CL="/DMEOW_HEADER=cassert" PM_CL="/DMEOW_HEADER=ccomplex /D_SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING" PM_CL="/DMEOW_HEADER=cctype"