为空间配置器增加销毁一段范围内对象的函数
This commit is contained in:
@@ -31,6 +31,7 @@ namespace TinySTL{
|
|||||||
static void construct(T *ptr);
|
static void construct(T *ptr);
|
||||||
static void construct(T *ptr, const T& value);
|
static void construct(T *ptr, const T& value);
|
||||||
static void destroy(T *ptr);
|
static void destroy(T *ptr);
|
||||||
|
static void destroy(T *first, T *last);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@@ -64,6 +65,12 @@ namespace TinySTL{
|
|||||||
void allocator<T>::destroy(T *ptr){
|
void allocator<T>::destroy(T *ptr){
|
||||||
ptr->~T();
|
ptr->~T();
|
||||||
}
|
}
|
||||||
|
template<class T>
|
||||||
|
void allocator<T>::destroy(T *first, T *last){
|
||||||
|
for (; first != last; ++first){
|
||||||
|
first->~T();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Reference in New Issue
Block a user