That move_iterator probably doesn't do what you think it does.
> typedef std::vector <std::string> tdVec;
> tdVec::iterator it;
> tdVec vec;
> vec.push_back("Hallo");
> vec.push_back("ich");
> vec.push_back("bin");
> vec.push_back("ein");
> vec.push_back("Beispiel");
> it = vec.begin();
> std::move_iterator<it>(2);
First of all "it" is not a type. So, std::move_iterator<it> doesn't
make any sense. Secondly, The move_iterator<> constructor doesn't
take a number. It takes an iterator to wrap.
What you probably meant to write is this:
auto it = vec.begin() + 2;
or this:
auto it = std::next(vec.begin(), 2);
There is also the older std::advance:
auto it = vec.begin();
std::advance(it, 2);
This gives you an iterator that points to "bin". The + operator works
because a vector iterator is a random access iterator and every random
access iterator supports this kind of "iterator arithmetic".
std::advance is a little more general in that it also supports other
iterators (like bidirectional ones).
std::next is the "functional version" of std::advance that is
supported since C++11.
> But this gives me an error:
> 'move_iterator' is not a member of 'std'
>
> What can I do?
move_iterator is also a C++11 feature. So, if you want to make use
of a C++11 feature, you should make sure that the compiler operates
in C++11 mode (or beyond).
Cheers!
SG