algorithms that destruct and copy_construct
- by FredOverflow
I am currently building my own toy vector for fun, and I was wondering if there is something like the following in the current or next standard or in Boost?
template<class T>
void destruct(T* begin, T* end)
{
while (begin != end)
{
begin -> ~T();
++begin;
}
}
template<class T>
T* copy_construct(T* begin, T* end, T* dst)
{
while (begin != end)
{
new(dst) T(*begin);
++begin;
++dst;
}
return dst;
}