diff --git a/TinySTL/Allocator.h b/TinySTL/Allocator.h index 42caa8a..b12e18c 100644 --- a/TinySTL/Allocator.h +++ b/TinySTL/Allocator.h @@ -31,6 +31,7 @@ namespace TinySTL{ static void construct(T *ptr); static void construct(T *ptr, const T& value); static void destroy(T *ptr); + static void destroy(T *first, T *last); }; template @@ -64,6 +65,12 @@ namespace TinySTL{ void allocator::destroy(T *ptr){ ptr->~T(); } + template + void allocator::destroy(T *first, T *last){ + for (; first != last; ++first){ + first->~T(); + } + } } #endif \ No newline at end of file