Pārlūkot izejas kodu

change: check allocated memory in vector::resize

greatbridf 2 gadi atpakaļ
vecāks
revīzija
210279a15b
1 mainītis faili ar 1 papildinājumiem un 0 dzēšanām
  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;