Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2003-11-04 03:51:18


Thorsten Ottosen wrote:
> > > But then, you should call it half_open_range ;-)
> >
> > Not necessarily :). Here's what we have:
> >
> > template< typename Tag >
> > struct range_traits
> > {
> > template< typename Range > static typename Range::value_type
> > size(Range const&);
> > template< typename Range > static typename Range::value_type
> > front(Range const&);
> > template< typename Range > static typename Range::value_type
> > back(Range const&);
> > };
> >
> > namespace tag {
> > struct half_open;
> > struct closed;
> > }
> >
> > template< typename T, typename Tag = tag::half_open >
> > struct range
> > {
> > // use range_traits<Tag> to implement variability aspects of
open,
> > // half-open and closed ranges
> > // ...
> > };
>
> It's not clear what's so good about this. Could you tell us?

I didn't claim it was good in any sense, but rather cited another prior art
on the topic that solves the dilemma of 'range' vs. 'half_open_range'
through use of tags and range traits encapsulating the corresponding
variability aspects.

Aleksey


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk