#ifndef _CONSTRUCT_H_ #define _CONSTRUCT_H_ #include #include "TypeTraits.h" namespace TinySTL{ template inline void construct(T1 *ptr1, const T2& value){ new(ptr1) T1(value); } template inline void destroy(T *ptr){ ptr->~T(); } template inline void _destroy(ForwardIterator first, ForwardIterator last, _true_type){} template inline void _destroy(ForwardIterator first, ForwardIterator last, _false_type){ for (; first != last; ++first){ destroy(&*first); } } template inline void destroy(ForwardIterator first, ForwardIterator last){ typedef typename _type_traits::is_POD_type is_POD_type; _destroy(first, last, is_POD_type()); } } #endif