Boost logo

Boost :

From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2000-01-07 10:29:48


From Gavin Collings <gcollings_at_[hidden]>
> > > Oh, here's another feature I like for my points: indexability (I like
> > > to be able to access the coordinates by index). That allows
> > > programmatic selection of orientation for things like scrollbars.
> > > Indexability is of course unusable when the types of x and y differ.
> > > OTOH this is definitely a corner case. I have no strong opinion on the
> > > topic.
> >
> > We can provide generic version of classes with two template parameters
> > (and without indexability) and a specialization for case T1==T2 with
> > operator[]. I think it will be reasonable solution.
>
> I have some sympathy with the overdesign comment, but it may be worthwhile
> considering the following for the generic version. It overloads the []
operator
> and uses function overloading to achieve programmatic selection on
orientation
> etc. Obviously, as it's a compile time thing, it can't be used for
looping over
> (x .. y) - but that shouldn't be a problem for just two coordinates.
>

Probably Dave's proposal for indexability was not for looping, but still for
runtime selection of coordinates - e.g. in scrollbar implementation. Your
solution is neat, but it doesn't solve such kind of problems. Probably I
agree with Dave's reply to you - it seems we must leave indexability out of
our classes.

-Alexy


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