I have for loop like below:
for (multimap<string,string>::iterator it2 = ppp.first;it2 != ppp.second; ++it2)
{
if(it2==ppp.second -1)
str=str+it2->second.substr(0,(it2->second).find('-'));
else
str=str+it2->second.substr(0,(it2->second).find('-'))+'&';
}
I am using the condition like below:
if(it2==ppp.second -1)
for checking the last element and do some additional functionality if i found the last element.But the above condition doesnt work. it throw's me an error:
"000001.cc", line 50: Error: The operation "__rwstd::__rb_tree<std::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::basic_string<char, std::char_traits<char>, std::allocator<char>>>, __rwstd::__select1st<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>::iterator - int" is illegal.
1 Error(s) detected.
Could anybody please help.