Hi everyone!
I have a following problem:
Compiler returns an error: 51 no matching function for call to `std::multiset< punkt, porownaj_x, std::allocator< punkt> >::upper_bound( int&)'
Multisets are working perfectly fine but upper_bound and lower_bound iterators aren't:( What is wrong in the code?
I have a following problem:
Code:
#include<iostream>
#include<set>
using namespace std;
struct punkt
{
int x;
int y;
};
struct porownaj_x {
bool operator() (const punkt& lhs, const punkt& rhs) const
{return lhs.x<rhs.x;}
};
struct porownaj_y {
bool operator() (const punkt& lhs, const punkt& rhs) const
{return lhs.y<rhs.y;}
};
int main()
{
int z;
cin >> z;
int a,b;
punkt zabytki[z];
for (int i=0; i<z; i++)
{
cin >> a >> b;
//tab[a][b]=1;
zabytki[i].x=a;
zabytki[i].y=b;
}
multiset<punkt,porownaj_x> sx;
multiset<punkt,porownaj_y> sy;
for (int i=0; i<z; i++)
{ sx.insert(zabytki[i]);
sy.insert(zabytki[i]);}
multiset<punkt, porownaj_x>::iterator itt;
int ub = 10;
for (itt=sx.upper_bound(ub); itt!=sx.end(); itt++)
cout << " " << (*itt).x << " " << (*itt).y;
cin.get();
cin.get();
return 0;
}
Compiler returns an error: 51 no matching function for call to `std::multiset< punkt, porownaj_x, std::allocator< punkt> >::upper_bound( int&)'
Multisets are working perfectly fine but upper_bound and lower_bound iterators aren't:( What is wrong in the code?
Comment