Boost logo

Boost :

Subject: Re: [boost] Geometry and spatial indexes, my opinion
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-10-09 16:38:38


Simonson, Lucanus J wrote:
> You will have to cast at some point to use the value, why is it more
> expensive to cast up front rather than at the last possible moment.

This only applies to built in types. For user defined types, it may not
be necessary to
cast in order to operate on objects of two different types.

> Assuming the value is going to be used more than once by the algorithm
> it will be cast more than once. Better to factor that to the front. A
> smart compiler would actually do that for you.

That's fine for built in types. What about user-defined types?

> Futhermore, there has to
> be a teomporary at the interface because as I've just discussed with
> Brandon, there is the clear need to make things like polar points
> conform to Cartesian interfaces, which is incompatible with direct
> access to the data members. Since we already have to make a temporary
> we should cast at that point instead of having yet another temoporary
> and cast later on.

Maybe I'm misunderstanding something, but it seems to me that an
algorithm that works
with Cartesian coordinates will tend to be very inefficient if it has to
to and from polar coordinates on the fly at every access.

In Christ,
Steven Watanabe

Boost list run by bdawes at, gregod at, cpdaniel at, john at