As Clang tells you, put typename in front of the iterator type:
template<typename T>
void transferOne(vector<std::unique_ptr<T> > &to,
typename vector<std::unique_ptr<T> >::iterator what,
vector<std::unique_ptr<T> > &from) {
to.push_back(std::move(*what));
from.erase(what);
}
The keyword typename
is used to tell the compiler, that vector<std::unique_ptr<T> >::iterator
is a type. Without instantiating the template, the compiler can't in general find that out by itself, because there might be a specialization of the template vector
, where the member iterator is a static variable instead.