move stuff instead of copy, forward correctly in emplace_back

master
Daniel Kolesa 2015-04-14 23:14:19 +01:00
parent 2f56d5b52b
commit d26db78f0d
1 changed files with 2 additions and 2 deletions

View File

@ -116,7 +116,7 @@ namespace octa {
} else {
T *cur = p_buf, *tcur = tmp, *last = tmp + p_len;
while (tcur != last) {
new (tcur++) T(*cur);
new (tcur++) T(move(*cur));
(*cur).~T();
++cur;
}
@ -147,7 +147,7 @@ namespace octa {
template<typename ...U>
T &emplace_back(U &&...args) {
if (p_len == p_cap) reserve(p_len + 1);
new (&p_buf[p_len]) T(args...);
new (&p_buf[p_len]) T(forward<U>(args)...);
return p_buf[p_len++];
}