Explorar el Código

change: check allocated memory in vector::resize

greatbridf hace 2 años
padre
commit
210279a15b
Se han modificado 1 ficheros con 1 adiciones y 0 borrados
  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;