فهرست منبع

sigh: constrain the allocator type

Michele Caini 4 سال پیش
والد
کامیت
3156dd1321
2فایلهای تغییر یافته به همراه2 افزوده شده و 1 حذف شده
  1. 1 1
      src/entt/signal/fwd.hpp
  2. 1 0
      src/entt/signal/sigh.hpp

+ 1 - 1
src/entt/signal/fwd.hpp

@@ -20,7 +20,7 @@ struct scoped_connection;
 template<typename>
 class sink;
 
-template<typename Type, typename = std::allocator<delegate<Type>>>
+template<typename Type, typename = std::allocator<Type *>>
 class sigh;
 
 } // namespace entt

+ 1 - 0
src/entt/signal/sigh.hpp

@@ -58,6 +58,7 @@ class sigh<Ret(Args...), Allocator> {
     friend class sink<sigh<Ret(Args...), Allocator>>;
 
     using alloc_traits = std::allocator_traits<Allocator>;
+    static_assert(std::is_same_v<typename alloc_traits::value_type, Ret (*)(Args...)>);
     using container_type = std::vector<delegate<Ret(Args...)>, typename alloc_traits::template rebind_alloc<delegate<Ret(Args...)>>>;
 
 public: