Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2008-08-19 21:06:53


on Tue Aug 19 2008, Daniel Krügler <dsp-AT-bdal.de> 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?)

> but this is not necessarily the case, if at least one of them is
> statefull (and therefore the complete class type is not empty). There
> are still good chances, that some (or even all) of them are still
> stateless (because they are not influenced by that state).
>
> 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.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net