
John Reid wrote:
Joachim Faulhaber wrote:
So it might be better to have both continuous and discrete intervals as right-open by default and to allow some mechanism whereby the user can choose to allow different runtime bound types if they need them.
I agree, that right-open intervals are suitable as default. But I am afraid, for the continuous case, we can not guarantee that all operations can maintain such an invariant. BTW existing interval libraries e.g. boost::numeric::interval or FILIB++ work with closed intervals. Subtract a closed interval from an interval set with continuous domain_type and you need open bounds.
I was suggesting that your design could feature sets/maps that only had right-open intervals. This would be the default in both continuous and discrete domains. If the user really wanted to use all the different interval bound types over a continuous domain then perhaps he/she could choose to do so via a template parameter. This would probably be a rare use case though.
I should just say that I think all the invariants can be maintained in sets of right-open intervals. Please correct me if I'm wrong.