Replace bind2nd with lambdas in turnport.cc for C++ 17 compatibility.
Bug: webrtc:8779 Change-Id: I0416cd6dff60b840734fb4e236a48ddcd84ef817 Reviewed-on: https://webrtc-review.googlesource.com/40981 Commit-Queue: Qingsi Wang <qingsi@google.com> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21702}
This commit is contained in:
parent
7464fca9f3
commit
dbd780992d
@ -1048,29 +1048,25 @@ void TurnPort::ResetNonce() {
|
||||
realm_.clear();
|
||||
}
|
||||
|
||||
static bool MatchesIP(TurnEntry* e, rtc::IPAddress ipaddr) {
|
||||
return e->address().ipaddr() == ipaddr;
|
||||
}
|
||||
bool TurnPort::HasPermission(const rtc::IPAddress& ipaddr) const {
|
||||
return (std::find_if(entries_.begin(), entries_.end(),
|
||||
std::bind2nd(std::ptr_fun(MatchesIP), ipaddr)) != entries_.end());
|
||||
[&ipaddr](const TurnEntry* e) {
|
||||
return e->address().ipaddr() == ipaddr;
|
||||
}) != entries_.end());
|
||||
}
|
||||
|
||||
static bool MatchesAddress(TurnEntry* e, rtc::SocketAddress addr) {
|
||||
return e->address() == addr;
|
||||
}
|
||||
TurnEntry* TurnPort::FindEntry(const rtc::SocketAddress& addr) const {
|
||||
EntryList::const_iterator it = std::find_if(entries_.begin(), entries_.end(),
|
||||
std::bind2nd(std::ptr_fun(MatchesAddress), addr));
|
||||
auto it = std::find_if(
|
||||
entries_.begin(), entries_.end(),
|
||||
[&addr](const TurnEntry* e) { return e->address() == addr; });
|
||||
return (it != entries_.end()) ? *it : NULL;
|
||||
}
|
||||
|
||||
static bool MatchesChannelId(TurnEntry* e, int id) {
|
||||
return e->channel_id() == id;
|
||||
}
|
||||
TurnEntry* TurnPort::FindEntry(int channel_id) const {
|
||||
EntryList::const_iterator it = std::find_if(entries_.begin(), entries_.end(),
|
||||
std::bind2nd(std::ptr_fun(MatchesChannelId), channel_id));
|
||||
auto it = std::find_if(entries_.begin(), entries_.end(),
|
||||
[&channel_id](const TurnEntry* e) {
|
||||
return e->channel_id() == channel_id;
|
||||
});
|
||||
return (it != entries_.end()) ? *it : NULL;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user