
2010/3/4 John Reid <j.reid@mail.cryst.bbk.ac.uk>:
Joachim Faulhaber wrote:
2010/3/4 John Reid <j.reid@mail.cryst.bbk.ac.uk>:
The default interval type is closed. Isn't right-open a more natural choice for most applications?
Good question ... I tried to change this in the past but encountered problems with unsigned integral domain types that flipped to max_int by singular applications of decrement operator -- in the current implementation. May be I should check this point more thoroughly again. I could get rid of the unloved unon<T>() meta function. ...
You seem to suggest you apply operator-- on integral domains here. Why not make the distance between intervals available when the domain is integral? This would be similar to the availability of first and last when the domain is discrete.
For all of the interval functions it turns out, that the functionality that I offer, which does not include interval arithmetics, only needs very few basic operations: <, ++, and -- on the the bound members of type domain_type. This keeps the requirements on my Interval parameter minimal and allows for a greater class of instance_types for parameter domain_type.
I know, that I am not completely consequent here. Functions length() and cardinality() use operator - . But if you don't need to call them, you can work with more primitive domain_type.
For my uses I would like to see a method to calculate the distance between 2 intervals available when the domain supports it. I feel many users are going to write this functionality themselves. Also a method to return the gap between 2 intervals would be useful. Just my 2 cents.
I dont't have a problem adding these functions. Best regards, Joachim