lundi 27 août 2018

lower_bound lambda comparison error

Trying to use a lambda as a Comp arg within a lower_bound func, with no luck. What am I doing wrong?

#include <vector>
#include <algorithm>

int main()
{
    vector<pair<int, pair<int, int>>> vertical(2);
    vector<pair<int, pair<int, int>>> horizontal(2);
    for (auto& h : horizontal)
    {
        auto it = std::lower_bound(vertical.begin(), vertical.end(), h,
            [](vector<pair<int, pair<int, int>>>::iterator it, vector<pair<int, pair<int, int>>>::iterator sec) -> bool { return it->first < sec->second.first; });
    }
}

Aucun commentaire:

Enregistrer un commentaire