Explorar o código

fix(vector): does nothing if size() == n

greatbridf hai 1 ano
pai
achega
94d7406520
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      include/types/vector.hpp

+ 3 - 0
include/types/vector.hpp

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