aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Grids/Notifiers/GridNotifiers.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h
index 2f75b5d7447..bff2785ca1f 100644
--- a/src/server/game/Grids/Notifiers/GridNotifiers.h
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.h
@@ -221,26 +221,27 @@ namespace Trinity
// Generic base class to insert elements into arbitrary containers using push_back
template<typename Type>
- class ContainerInserter {
+ class ContainerInserter
+ {
using InserterType = void(*)(void*, Type&&);
void* ref;
InserterType inserter;
- // MSVC workaround
+ protected:
template<typename T>
- static void InserterOf(void* ref, Type&& type)
+ ContainerInserter(T& ref_) : ref(&ref_)
{
- static_cast<T*>(ref)->push_back(std::move(type));
+ inserter = [](void* containerRaw, Type&& object)
+ {
+ T* container = reinterpret_cast<T*>(containerRaw);
+ container->insert(container->end(), std::move(object));
+ };
}
- protected:
- template<typename T>
- ContainerInserter(T& ref_) : ref(&ref_), inserter(&InserterOf<T>) { }
-
- void Insert(Type type)
+ void Insert(Type object)
{
- inserter(ref, std::move(type));
+ inserter(ref, std::move(object));
}
};