diff options
| author | 2020-11-11 02:25:06 +0000 | |
|---|---|---|
| committer | 2020-11-11 02:29:36 +0000 | |
| commit | 2d6d47b489d733ca3c29fc2f963d424029fcb929 (patch) | |
| tree | fa38bdd2dcbebdb126d29482bfb7d5389a10c2d4 /src/mode.cpp | |
| parent | Convert FOREACH_MOD_CUSTOM to a variadic function. (diff) | |
Add stdalgo::equal_range and switch more stuff to iterator_range.
Diffstat (limited to 'src/mode.cpp')
| -rw-r--r-- | src/mode.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/mode.cpp b/src/mode.cpp index 46dd502e0..64f844e28 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -297,10 +297,8 @@ ModeAction ModeParser::TryMode(User* user, User* targetuser, Channel* chan, Mode } // Ask mode watchers whether this mode change is OK - std::pair<ModeWatcherMap::iterator, ModeWatcherMap::iterator> itpair = modewatchermap.equal_range(mh->name); - for (ModeWatcherMap::iterator i = itpair.first; i != itpair.second; ++i) + for (const auto& [_, mw] : stdalgo::equal_range(modewatchermap, mh->name)) { - ModeWatcher* mw = i->second; if (mw->GetModeType() == type) { if (!mw->BeforeMode(user, targetuser, chan, parameter, adding)) @@ -337,10 +335,8 @@ ModeAction ModeParser::TryMode(User* user, User* targetuser, Channel* chan, Mode if (ma != MODEACTION_ALLOW) return ma; - itpair = modewatchermap.equal_range(mh->name); - for (ModeWatcherMap::iterator i = itpair.first; i != itpair.second; ++i) + for (const auto& [_, mw] : stdalgo::equal_range(modewatchermap, mh->name)) { - ModeWatcher* mw = i->second; if (mw->GetModeType() == type) mw->AfterMode(user, targetuser, chan, parameter, adding); } @@ -502,10 +498,8 @@ void ModeParser::ShowListModeList(User* user, Channel* chan, ModeHandler* mh) bool display = true; // Ask mode watchers whether it's OK to show the list - std::pair<ModeWatcherMap::iterator, ModeWatcherMap::iterator> itpair = modewatchermap.equal_range(mh->name); - for (ModeWatcherMap::iterator i = itpair.first; i != itpair.second; ++i) + for (const auto& [_, mw] : stdalgo::equal_range(modewatchermap, mh->name)) { - ModeWatcher* mw = i->second; if (mw->GetModeType() == MODETYPE_CHANNEL) { std::string dummyparam; |
