C++ :: Using Comparator In Set
Dec 12, 2012I have the piece of code
Code:
#include<iostream>
#include<set>
using namespace std;
class Test {
public:
int val;
[Code] ....
gives following error
setTest.cpp: In function "int main()":
setTest.cpp:26: error: type/value mismatch at argument 2 in template parameter list for "template<class _Key, class _Compare, class _Alloc> class std::set"
setTest.cpp:26: error: expected a type, got "cmp"
setTest.cpp:26: error: invalid type in declaration before ";" token
My doubt is why we can only use functor and not predicate function. because in algorithms we can use both functor and predicate.