I have a std::vector with element of the type std::pair. With some algorithm, I return two iterators (range) so I would like to pick up all elements within that range and copy t
It's because of the operator precedence. The select operator . has higher precedence than the dereference operator *.
.
*
So what the compiler thinks you're writing is
*(it1.first)
when you mean
(*it1).first