qBittorrent
Algorithm Namespace Reference

Classes

struct  HasMappedType
 
struct  HasMappedType< T, std::void_t< typename T::mapped_type > >
 

Functions

template<typename T , typename BinaryPredicate , typename std::enable_if_t< HasMappedType< T >::value, int > = 0>
void removeIf (T &dict, BinaryPredicate &&p)
 
template<typename T , typename UnaryPredicate , typename std::enable_if_t<!HasMappedType< T >::value, int > = 0>
void removeIf (T &set, UnaryPredicate &&p)
 

Function Documentation

◆ removeIf() [1/2]

template<typename T , typename BinaryPredicate , typename std::enable_if_t< HasMappedType< T >::value, int > = 0>
void Algorithm::removeIf ( T &  dict,
BinaryPredicate &&  p 
)

Definition at line 50 of file algorithm.h.

51  {
52  auto it = dict.begin();
53  while (it != dict.end())
54  it = (p(it.key(), it.value()) ? dict.erase(it) : ++it);
55  }

Referenced by Http::Server::dropTimedOutConnection(), OrderedSet< T, Compare >::intersect(), TorrentFilesWatcher::Worker::processFailedTorrents(), BitTorrent::Session::removeCategory(), WebApplication::sessionStart(), and Preferences::setWebUiAuthSubnetWhitelist().

Here is the caller graph for this function:

◆ removeIf() [2/2]

template<typename T , typename UnaryPredicate , typename std::enable_if_t<!HasMappedType< T >::value, int > = 0>
void Algorithm::removeIf ( T &  set,
UnaryPredicate &&  p 
)

Definition at line 60 of file algorithm.h.

61  {
62  auto it = set.begin();
63  while (it != set.end())
64  it = (p(*it) ? set.erase(it) : ++it);
65  }