In this assignment, I'm making an application where a user inputs a phone number whether it be letters or not.
I've tried using the const on maps or vector to see if it fixes the problem, but I think it just created more errors.
Here's the code that I think that causes some problems
std::vector<int> mappednums;
for (char& achar : word) {
auto itr = std::find_if(lookupmap.begin(), lookupmap.end(), [&](std::pair<int, std::vector<char>>& aPair)->bool
{
auto itr = std::find_if(aPair.second.begin(), aPair.second.end(), [&](char& ch) {
return ch == achar;
});
if (itr != aPair.second.end()) {
return true;
}
});
if (itr != lookupmap.end()) {
mappednums.push_back(itr->first);
}
I expected this to find a pair, but it gives me an error saying it cannot convert argument 1 from the code above. Here's the error:
'bool main::<lambda_06927067034dcc4076cc2514a7e290fe>::operator ()(std::pair<int,std::vector<char,std::allocator<char>>> &) const': cannot convert argument 1 from 'std::pair<const _Kty,_Ty>' to 'std::pair<int,std::vector<char,std::allocator<char>>> &'