我目前正在建立我自己的玩具vector
爲樂趣,我想知道是否有像在當前或下一個標準或在提升下面的東西?算法,破壞和copy_construct
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;
}
啊,'uninitialized_copy'正是我在找的東西。謝謝! – fredoverflow 2010-05-07 14:00:33