You need to use the correct type which is decltype(temp)::iterator ptr1 = temp.begin();
– that is, ptr1
is a std::string::iterator
, not a std::vector<std::string>::iterator
. So for your snippet to compile, change
std::vector<std::string>::iterator ptr1 = temp.begin();
to
auto ptr1 = temp.begin(); // ptr1 is a std::string::iterator
2
solved error message of no suitable user-defined conversion [closed]