Browse Source

allocate_unique: static assert that Type isn't an array type

Michele Caini 4 years ago
parent
commit
f750254cc2
1 changed files with 2 additions and 0 deletions
  1. 2 0
      src/entt/core/memory.hpp

+ 2 - 0
src/entt/core/memory.hpp

@@ -143,6 +143,8 @@ struct allocation_deleter: private Allocator {
  */
  */
 template<typename Type, typename Allocator, typename... Args>
 template<typename Type, typename Allocator, typename... Args>
 auto allocate_unique(Allocator &allocator, Args &&...args) {
 auto allocate_unique(Allocator &allocator, Args &&...args) {
+    static_assert(!std::is_array_v<Type>, "Array types are not supported");
+
     using alloc = typename std::allocator_traits<Allocator>::template rebind_alloc<Type>;
     using alloc = typename std::allocator_traits<Allocator>::template rebind_alloc<Type>;
     using alloc_traits = typename std::allocator_traits<alloc>;
     using alloc_traits = typename std::allocator_traits<alloc>;