Use std::erase_if in base/metrics/statistics_recorder.cc

Bug: 41408868
Change-Id: I33ca466a8a1e06fc445e2ad8d302f8a0f326de57
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7079088
Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
Reviewed-by: Francois Pierre Doray <fdoray@chromium.org>
Commit-Queue: Jincheol Jo <jincheol.jo@navercorp.com>
Cr-Commit-Position: refs/heads/main@{#1535418}
NOKEYCHECK=True
GitOrigin-RevId: 28d6f3a02938a209686eee08c50a18a15a4bf957
diff --git a/metrics/statistics_recorder.cc b/metrics/statistics_recorder.cc
index 4b950e4..d450839 100644
--- a/metrics/statistics_recorder.cc
+++ b/metrics/statistics_recorder.cc
@@ -590,9 +590,7 @@
   // Erase the non-matching histograms. Note that `histograms` was passed by
   // value so we can efficiently remove the unwanted elements and return the
   // local instance.
-  histograms.erase(std::remove_if(histograms.begin(), histograms.end(),
-                                  histogram_name_does_not_contain_query),
-                   histograms.end());
+  std::erase_if(histograms, histogram_name_does_not_contain_query);
   return histograms;
 }