on Tue Aug 19 2008, Daniel Krügler
David Abrahams wrote:
on Tue Aug 19 2008, Daniel Krügler
wrote: An operator== that applied for only one of many overloads would be an abomination, especially if the class were empty.
Right, if the class is empty, all operator() overloads are stateless,
What about random number generators (or anything else that uses global state?)
Note that I'm restricting on EqualityComparable for predicates (therefore I carefully choose the name comparable_predicate).
Can you think of any reasonable *predicate* with global state?
has_this_time_been_reached( sometime )
Or to express the problem in different words: In general there exists a one-to-many relation between a class type and it's operator() overloads [acting as predicates], so the class-type alone is not sufficient to define an equality of *one* special operator() overload, which we are interested in. Therefore the predicate equality needs to be restricted to a given predicate (a given operator() overload).
I think you're over-engineering this. It's not unreasonable to require operator== to make sense in this context.
This answer is a bit too short for me and has not the convincing power which we usually get from your contributions ;-)
Thanks; I've been under the weather. Still, I don't know how to say it much better. -- Dave Abrahams BoostPro Computing http://www.boostpro.com