From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2003-11-04 06:48:01
"Aleksey Gurtovoy" <agurtovoy_at_[hidden]> wrote in message
> Thorsten Ottosen wrote:
> FWIW, a lot of user input comes in the form of closed ranges (e.g. dates,
> pages, etc.).
> > IMO, it
> > is not a good thing because all the ranges can be used to describe
> > eachother:
> > [begin,end] = [begin, end + 1 )
> > (begin, end) = [begin +1, end )
> > (begin, end] = [begin + 1, end + 1 )
> > To me it seems that it shall only be necessary with one type of range.
> > Bringing more into the picture will only bring confusion.
> > Aleksey, what do you use the different range types to at your work?
> Yes, we use both half-open and closed ranges - the latter for the use
> I cited above.
OK, I see your point. You use different classes and a traits mechanism to
range differences, ie., you can always say
size( range<T,Tag> )
and get the right size depending on the type of the range. So a function
would look like
void foo( range<T,tag::closed> r )
X = size( r );
void foo( range<T> closed_range )
X = closed_size( closed_range );
It's not a big win, but I can see the benefit of letting the type system
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk