The problem here is that you expect that a list is the same as a vector, and can be used interchangeably.
First of all when you dereference an iterator, it returns the the type of the container, in your case an instance of Contact
. Secondly, you can't use array-like indexing on a std::list
.
To solve the first problem, you have to keep track of indexes yourself.
To solve the second problem, you already have the iterator and can use that in the push_back
call:
tmp.push_back(*it);