Remove deprecated std::bind2nd and std::ptr_fun
std::bind2nd and std::ptr_fun are deprecated in C++11 and removed in C++17. This CL removes their usage, so that the code base is ready for C++17. Bug: chromium:752720 Change-Id: I6ec0b596202ebf84cf7b8744f516a76ac8328ccd Reviewed-on: https://webrtc-review.googlesource.com/72360 Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Taiju Tsuiki <tzik@chromium.org> Cr-Commit-Position: refs/heads/master@{#23083}
This commit is contained in:
@ -548,22 +548,6 @@ static bool GetCryptosByName(const SessionDescription* sdesc,
|
||||
return true;
|
||||
}
|
||||
|
||||
// Predicate function used by the remove_if.
|
||||
// Returns true if the |crypto|'s cipher_suite is not found in |filter|.
|
||||
static bool CryptoNotFound(const CryptoParams crypto,
|
||||
const CryptoParamsVec* filter) {
|
||||
if (filter == NULL) {
|
||||
return true;
|
||||
}
|
||||
for (CryptoParamsVec::const_iterator it = filter->begin();
|
||||
it != filter->end(); ++it) {
|
||||
if (it->cipher_suite == crypto.cipher_suite) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Prunes the |target_cryptos| by removing the crypto params (cipher_suite)
|
||||
// which are not available in |filter|.
|
||||
static void PruneCryptos(const CryptoParamsVec& filter,
|
||||
@ -571,11 +555,19 @@ static void PruneCryptos(const CryptoParamsVec& filter,
|
||||
if (!target_cryptos) {
|
||||
return;
|
||||
}
|
||||
target_cryptos->erase(std::remove_if(target_cryptos->begin(),
|
||||
target_cryptos->end(),
|
||||
bind2nd(ptr_fun(CryptoNotFound),
|
||||
&filter)),
|
||||
target_cryptos->end());
|
||||
|
||||
target_cryptos->erase(
|
||||
std::remove_if(target_cryptos->begin(), target_cryptos->end(),
|
||||
// Returns true if the |crypto|'s cipher_suite is not
|
||||
// found in |filter|.
|
||||
[&filter](const CryptoParams& crypto) {
|
||||
for (const CryptoParams& entry : filter) {
|
||||
if (entry.cipher_suite == crypto.cipher_suite)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}),
|
||||
target_cryptos->end());
|
||||
}
|
||||
|
||||
bool IsRtpProtocol(const std::string& protocol) {
|
||||
|
Reference in New Issue
Block a user