Преглед на файлове

dense_set: constrain the allocator type

Michele Caini преди 4 години
родител
ревизия
2fbeeafbb8
променени са 1 файла, в които са добавени 1 реда и са изтрити 0 реда
  1. 1 0
      src/entt/container/dense_set.hpp

+ 1 - 0
src/entt/container/dense_set.hpp

@@ -231,6 +231,7 @@ class dense_set {
 
     using node_type = std::pair<std::size_t, Type>;
     using alloc_traits = std::allocator_traits<Allocator>;
+    static_assert(std::is_same_v<typename alloc_traits::value_type, Type>);
     using sparse_container_type = std::vector<std::size_t, typename alloc_traits::template rebind_alloc<std::size_t>>;
     using packed_container_type = std::vector<node_type, typename alloc_traits::template rebind_alloc<node_type>>;