P
PicO
how can i make a set with comparison function ?
all i know that i can make a map with comparison function like this
struct strCmp {
bool operator()( const char* s1, const char* s2 ) const {
return strcmp( s1, s2 ) < 0;
}
};
map<const char*, int, strCmp> ages;
while how can i make set of integers with comparison function ?
struct Cmp
{
bool operator()( const int* s1, const int* s2 ) const {
return s1<=s2 ? true : false ;
}
};
set < int , Cmp > s;
all i know that i can make a map with comparison function like this
struct strCmp {
bool operator()( const char* s1, const char* s2 ) const {
return strcmp( s1, s2 ) < 0;
}
};
map<const char*, int, strCmp> ages;
while how can i make set of integers with comparison function ?
struct Cmp
{
bool operator()( const int* s1, const int* s2 ) const {
return s1<=s2 ? true : false ;
}
};
set < int , Cmp > s;