Когда я пытался реализовать метод для поиска пар, содержащих некоторый текст, я столкнулся с ошибкой компиляции, которая говорит:
c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\algorithm(585): error C2280: "std::pair &std::pair::operator =(volatile const std::pair &)": attempting to reference a deleted function while using
Мой код:
map<string,string> dict;
string srch_wrd;
bool pred_name(string str) {
bool res = 0;
if (str.find(srch_wrd) != -1)
res = 1;
return res;
}
void find() {
map<string, string> buff;
cout << "Enter keyword" <<endl;
cin >> srch_wrd;
copy_if(dict.begin(), dict.end(), buff.begin(), [](auto const& obj) {return (pred_name(obj.first)&& pred_name(obj.second)); });
for (auto i = buff.begin(); i != buff.end(); i++)
{
cout << i->first << " - " << i->second << endl;
}
}