find an element in vector of pair c++

#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    std::vector<std::pair<int, std::string>> vecOfPairs = {{1, "one"}, {2, "two"}, {3, "three"}, {4, "four"}, {5, "five"}};

    int keyToFind = 3;

    auto it = std::find_if(vecOfPairs.begin(), vecOfPairs.end(),
                           [keyToFind](const std::pair<int, std::string>& element) {
                               return element.first == keyToFind;
                           });

    if (it != vecOfPairs.end()) {
        std::cout << "Element found: " << it->first << ", " << it->second << std::endl;
    } else {
        std::cout << "Element not found" << std::endl;
    }

    return 0;
}