Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete std::experimental::erase/erase_if #4470

Merged
merged 9 commits into from
Mar 16, 2024

Conversation

StephanTLavavej
Copy link
Member

My std::experimental::erase/erase_if were deprecated by #236 implementing std::erase/erase_if, merged on 2019-11-01. This shipped on 2020-03-16 as part of VS 2019 16.5. Users have had 4 years of deprecation notice, and this machinery was always marked as experimental. It's time to follow through on our promise. This slightly reduces our surface area (making our repo and VS installations slightly smaller, avoiding the slight navigation headache of having both vector and experimental/vector), but my real motivation is modules - only std::erase/erase_if are available through the Standard Library Modules, so we should encourage users to write Standard code. (While std::erase/erase_if are C++20, any users who eagerly reached for experimental TS machinery should be expected to have eagerly upgraded their Standard mode. Users can also write simple fallbacks if upgrading their Standard mode is somehow impractical, described below.)

Aside: The equally MS-deprecated <experimental/filesystem>, <hash_meow>, and stdext::checked_array_iterator were much more widely used (unlike <cvt/meow>, which was never documented and which I believe was virtually unused outside of our test suite, hence #4458 removing it), and they involve types, not just functions like erase/erase_if. (Accordingly, I don't think it's feasible to remove those types until vNext.) While the experimental Uniform Container Erasure functions probably got a bit of use, removing these functions is a non-event for ABI, and migration is very simple to deal with. (Either upgrade to C++20 and use the Standard functions, or fall back to classic erase-remove[_if] for vector-like containers, member remove[_if] for list-like containers, or a node removal loop for associative containers.)

Structured commits:

  • Delete the experimental headers for erase/erase_if (9 files, 11,814 bytes).
  • Remove all mentions of the headers.
  • Replace the deprecation macro with a tombstone.
  • Remove all mentions of the silencing macro.
  • Remove the feature-test macro and its test.
  • Remove compile-only test coverage of std::experimental::fundamentals_v2::erase/erase_if.
    • We're still testing std::erase/erase_if.
    • Move auto pr1 and vector<bool> vb within #if _HAS_CXX20 to avoid any potential unused-variable warnings. (We surely instantiate vector<bool> elsewhere, so we're not giving up any test coverage here.)
  • Remove test coverage for std::experimental::erase/erase_if.
    • This was copy-pasted for // P1209R0 erase_if(), erase() below, further enhanced to inspect the return values that were added to the Standard, so we aren't losing any test coverage.
    • The test coverage for P0458R2 contains() used the final contents of the ordered/unordered associative containers, so I'm defining them with copy-list-initialization to match the const containers below.
  • Followup: Fuse _HAS_CXX20 regions.
  • Avoid Clang -Wunused-parameter warnings.

⚠️ As usual, this will require MSVC-internal changes to remove files.

…erase/erase_if`.

We're still testing `std::erase/erase_if`.

Move `auto pr1` and `vector<bool> vb` within `#if _HAS_CXX20` to avoid any potential unused-variable warnings. (We surely instantiate `vector<bool>` elsewhere, so we're not giving up any test coverage here.)
This was copy-pasted for `// P1209R0 erase_if(), erase()` below, further enhanced to inspect the return values that were added to the Standard, so we aren't losing any test coverage.

The test coverage for `P0458R2 contains()` used the final contents of the ordered/unordered associative containers, so I'm defining them with copy-list-initialization to match the `const` containers below.
@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Mar 12, 2024
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner March 12, 2024 02:50
@StephanTLavavej StephanTLavavej self-assigned this Mar 15, 2024
@StephanTLavavej
Copy link
Member Author

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit a286993 into microsoft:main Mar 16, 2024
37 checks passed
@StephanTLavavej StephanTLavavej deleted the eraser-eraser branch March 16, 2024 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something can be improved
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants