Just a general preference question; when using a functor/function pointer to sort or find elements in a list, would you rather the functor argument be binary (i.e. take 2 arguments and return true/false for less than/equal), or would you rather the functor argument be unary (i.e. take one argument, return another argument, and let the sort/find function do the comparison)?
Code:
struct Structure
{
int Value;
};
//...would you want to use this to sort:
bool
LESS_THAN(Structure A, Structure B)
{ return A.Value < B.Value; }
//and these to find:
bool
EQUAL(Structure A, Structure B)
{ return A.Value == B.Value; }
bool
EQUAL(Structure A, int B)
{ return A.Value == B; }
//...or this for everything:
int
GET_VALUE(Structure A)
{ return A.Value; }
//and then let the find/sort function call the comparison operator?
The reason I ask is because my list class currently takes exclusively unary functors, but if a lot of people would prefer binary functors I will change them. I think I am going to change the sort functors to binary only and provide an adapter for users who want to use unary. I will create an adapter so the other type can be used (unary/binary) either way, but I would like the natural functor type to be that which is preferred most. Thanks for your opinion!
ta0kira