I'm trying to find the upper and lower bounds of my vector (vector possible) using these functions. The struct data holds 3 strings and I'm using string date for comparison.
bool myCompare(Data &a, Data &b) {
return (a.date == b.date);
}
#include <algorithm>
std::vector<Data>::iterator iterl, iteru;
sort(possible.begin(), possible.end(), compare);
iterl = std::lower_bound(possible.begin(), possible.end(), struct1, myCompare);
iteru = std::upper_bound(possible.begin(), possible.end(), struct2, myCompare);
but by doing that, the compiler is displayng the following message:
Main.cpp:95:18: note: in instantiation of function template specialization 'std::__1::upper_bound<std::__1::__wrap_iter<data *>,
data, bool (*)(data &, data &)>' requested here
iteru = std::upper_bound(possible.begin(), possible.end(), struct2, myCompare);
whats the proper way to use these functions?