expression templates

spir denis.spir at gmail.com
Tue Mar 29 12:48:04 PDT 2011


On 03/29/2011 09:15 PM, dsimcha wrote:
> == Quote from bearophile (bearophileHUGS at lycos.com)'s article
>> The operator overloading done with opCmp is too much coarse even if you want to
> implement sets with operators like<=<  >  >= == for subset, etc.
>
> Can you please give an example of where<=,>, etc. are useful for representing
> set operations?  My naive opinion (i.e. without understanding your use case) is
> that using comparison operators to represent anything besides partial or total
> ordering is a severe abuse of operator overloading.  (Their use to represent
> ordering of corresponding elements of a vector or matrix is a borderline case.)

Agreed.

Wild guess: maybe Bearophile meant < <= > >= as operators for subset/superset 
predicates? Anyway, this is a very different idea.

A different, far less abusing, use of those operators on sets may be to compare 
cardinality, as in the original theory of natural numbers as sets; here, I 
guess, the analogy is far more meaningful and totally consistent.

Denis
-- 
_________________
vita es estrany
spir.wikidot.com



More information about the Digitalmars-d mailing list