Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Lower_bound not found for vector of pairs in c++

I am trying to find lower_bound on vector of pair of int. But my IDE, as well my compiler throws an error. Please someone help.

Lower_bound works for normal single dimensional vector. But fails for vector of pairs.

Please help me find a solution.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

LB is the macro which is defined as lower_bound .

Here you can see can see screenshot

enter image description here

>Solution :

Here’s how it works. Tell the type of the 3rd argument.

#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;

int main()
{
    vector<pair<int, int> > v;
    lower_bound(v.begin(), v.end(), std::pair<int, int>{10,1});

    return 0;
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading