diff options
author | Shauren <shauren.trinity@gmail.com> | 2017-07-23 23:32:20 +0200 |
---|---|---|
committer | Treeston <treeston.mmoc@gmail.com> | 2017-07-29 15:04:45 +0200 |
commit | d24ce1739a799042d5a164794c09674227c8572c (patch) | |
tree | 22a4985cf3be88b2ea3d728dd12c7492b3f4f65e /src/common/Utilities/Containers.h | |
parent | 9cbacb56da20b4242d6acd65c4a1babfec4e8158 (diff) |
Core/Misc: Util changes
* Move IteratorPair to its own header
* Add AsUnderlyingType function to cast enum value to its underlying type (avoids repeating std::underlying_type everywhere)
(cherry picked from commit fdd9227b232db9aae9bc4b2c60ca4de2cdaa0b54)
Diffstat (limited to 'src/common/Utilities/Containers.h')
-rw-r--r-- | src/common/Utilities/Containers.h | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/src/common/Utilities/Containers.h b/src/common/Utilities/Containers.h index 6cd95676bdf..424b4079e69 100644 --- a/src/common/Utilities/Containers.h +++ b/src/common/Utilities/Containers.h @@ -198,32 +198,6 @@ namespace Trinity return itr != map.end() ? AddressOrSelf(itr->second) : nullptr; } - /** - * @class IteratorPair - * - * @brief Utility class to enable range for loop syntax for multimap.equal_range uses - */ - template<class iterator> - class IteratorPair - { - public: - IteratorPair() : _iterators() { } - IteratorPair(iterator first, iterator second) : _iterators(first, second) { } - IteratorPair(std::pair<iterator, iterator> iterators) : _iterators(iterators) { } - - iterator begin() const { return _iterators.first; } - iterator end() const { return _iterators.second; } - - private: - std::pair<iterator, iterator> _iterators; - }; - - template<class M> - inline auto MapEqualRange(M& map, typename M::key_type const& key) -> IteratorPair<decltype(map.begin())> - { - return { map.equal_range(key) }; - } - template<class K, class V, template<class, class, class...> class M, class... Rest> void MultimapErasePair(M<K, V, Rest...>& multimap, K const& key, V const& value) { |