I feel, like it's something easy, but I can't find an answer by myself.
auto iterator = _map.find(key);
DeliveryData smth;
if(/*check*/)
smth = iterator->second;
return(smth);
How can I check for the result of find-method in this context? I know about contains in C++20. Any other method?
I forgot to say that find doesn't returns C++ expression of type bool or a type that can be converted to bool. It was not clear to me what should I use to compare with iterator.
Aucun commentaire:
Enregistrer un commentaire