From f8d8d6d00c163f9a43c1ebd76238f1c24978618b Mon Sep 17 00:00:00 2001 From: Yusuke Suzuki Date: Thu, 17 May 2018 22:01:13 +0900 Subject: [PATCH] Use range-based-for instead of std::for_each and std::mem_fun MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit std::mem_fun is deprecated in C++11, and removed in C++17. Using C++17 option for building libwebrtc causes build failure. This is found during upgrading WebKit tree from C++14 to C++17. This patch replaces std::for_each and std::mem_fun with range-based-for. We also merge loops for streams_ into one. Bug: webrtc:9277 Change-Id: I44a7e44ea21fc33ffa9a586ddfea570f97dfacb6 Reviewed-on: https://webrtc-review.googlesource.com/77280 Reviewed-by: Niels Moller Reviewed-by: Björn Terelius Commit-Queue: Björn Terelius Cr-Commit-Position: refs/heads/master@{#23285} --- AUTHORS | 1 + call/bitrate_estimator_tests.cc | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/AUTHORS b/AUTHORS index 8e7e1830a4..83a74af633 100644 --- a/AUTHORS +++ b/AUTHORS @@ -61,6 +61,7 @@ Hans Knoechel Korniltsev Anatoly Todd Wong Maxim Pavlov +Yusuke Suzuki &yet LLC <*@andyet.com> Agora IO <*@agora.io> diff --git a/call/bitrate_estimator_tests.cc b/call/bitrate_estimator_tests.cc index 313533a7ad..6b69bc069b 100644 --- a/call/bitrate_estimator_tests.cc +++ b/call/bitrate_estimator_tests.cc @@ -136,13 +136,11 @@ class BitrateEstimatorTest : public test::CallTest { virtual void TearDown() { task_queue_.SendTask([this]() { - std::for_each(streams_.begin(), streams_.end(), - std::mem_fun(&Stream::StopSending)); - - while (!streams_.empty()) { - delete streams_.back(); - streams_.pop_back(); + for (auto* stream : streams_) { + stream->StopSending(); + delete stream; } + streams_.clear(); send_transport_.reset(); receive_transport_.reset();