Answers for "find an element in vector of pair c++"

C++
2

search in vector of pairs c++

bool isEqual(const std::pair<std::string, int>& element)
{
    return element.first ==  User.name;
}
it = std::find_if( sortList.begin(), sortList.end(), isEqual );
Posted by: Guest on April-27-2021
0

find an element in vector of pair c++

auto index = std::distance(dict.begin(), std::find_if(dict.begin(), dict.end(), [&](const auto& pair) { return pair.first == movieName; }));
Posted by: Guest on September-20-2021
1

search in vector of pairs c++

auto it = std::find_if( sortList.begin(), sortList.end(),
    [&User](const std::pair<std::string, int>& element){ return element.first == User.name;} );
Posted by: Guest on April-27-2021

Browse Popular Code Answers by Language