Boost logo

Boost :

From: mikewatkins (mikewatkins_at_[hidden])
Date: 2000-01-09 05:59:41


Hi I tried to use this but was unable to. I do not seem to have #include
<cassert> could someone please send me this?

regards Mike

----- Original Message -----
From: Gavin Collings <gcollings_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Friday, January 07, 2000 11:39 AM
Subject: [boost] Re: a new version of geometry classes

> > > 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.
>
> struct x_coord {} x;
> struct y_coord {} y;
>
> template <typename X, typename Y = X> class point
> {
> public:
>
> X operator[]( x_coord ) { return x_; }
> Y operator[]( y_coord ) { return y_; }
>
> private:
>
> X x_;
> Y y_;
> };
>
> class latitude {};
> class longitude {};
>
> void process_coord( latitude ) {}
> void process_coord( longitude ) {}
>
>
> void test()
> {
> point<latitude, longitude> p;
>
> latitude lat = p[x];
> longitude lon = p[y];
>
> process_coord( p[x] );
> process_coord( p[y] );
> }
>
> Gavin
>
> --
> Gavin Collings
> gcollings_at_[hidden]
>
> ------------------------------------------------------------------------
> Looking for educational tools for you kids?
> Find everything you need at SmarterKids.com
> http://click.egroups.com/1/645/1/_/9351/_/947245373/
>
> eGroups.com Home: http://www.egroups.com/group/boost/
> http://www.egroups.com - Simplifying group communications
>
>


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