aboutsummaryrefslogtreecommitdiff
path: root/src/common/Containers
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/Containers')
-rw-r--r--src/common/Containers/Utilities/MapUtils.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/common/Containers/Utilities/MapUtils.h b/src/common/Containers/Utilities/MapUtils.h
index 910f16022a6..88f25c1d28a 100644
--- a/src/common/Containers/Utilities/MapUtils.h
+++ b/src/common/Containers/Utilities/MapUtils.h
@@ -23,10 +23,17 @@
namespace Trinity::Containers
{
+template <typename M>
+concept Map = requires (M)
+{
+ typename M::key_type;
+ typename M::mapped_type;
+};
+
/**
* Returns a pointer to mapped value (or the value itself if map stores pointers)
*/
-template<class M>
+template <Map M>
inline auto MapGetValuePtr(M& map, typename M::key_type const& key)
{
using mapped_type = typename M::mapped_type;
@@ -46,8 +53,8 @@ inline auto MapGetValuePtr(M& map, typename M::key_type const& key)
return itr != map.end() ? std::addressof(itr->second) : nullptr; // value
}
-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)
+template <Map M>
+void MultimapErasePair(M& multimap, typename M::key_type const& key, typename M::mapped_type const& value)
{
auto range = multimap.equal_range(key);
for (auto itr = range.first; itr != range.second;)