为空间配置器增加销毁一段范围内对象的函数

This commit is contained in:
邹晓航
2014-09-20 09:55:50 +08:00
parent b7584d4e5d
commit 09ec83a740

View File

@@ -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<class T>
@@ -64,6 +65,12 @@ namespace TinySTL{
void allocator<T>::destroy(T *ptr){
ptr->~T();
}
template<class T>
void allocator<T>::destroy(T *first, T *last){
for (; first != last; ++first){
first->~T();
}
}
}
#endif