Browse Source

change: check allocated memory in vector::resize

greatbridf 2 years ago
parent
commit
210279a15b
1 changed files with 1 additions and 0 deletions
  1. 1 0
      include/types/vector.hpp

+ 1 - 0
include/types/vector.hpp

@@ -173,6 +173,7 @@ public:
     constexpr void resize(size_type n)
     {
         value_type* new_ptr = allocator_traits<allocator_type>::allocate(n);
+        assert(!n || (n && new_ptr));
 
         m_capacity = n;
         size_t orig_size = m_size;