Boost logo

Boost :

From: Geoffrey Irving (irving_at_[hidden])
Date: 2006-09-20 12:38:27


On Wed, Sep 20, 2006 at 05:25:39PM +0100, Olivier Grant wrote:
> Hi,
>
> I have written a bit of code to handle geometric vectors in a generic way,
> abstracting their dimension. The idea behind this code is to be able to
> apply one operation between two vectors, or a vector and a scalar, whatever
> their dimension, and writing it in an expandable way without having to
> modify any manipulation functions if a new geometric vector class is
> created. The other advantage is that the resulting assembly code is just as
> fast as if the functions had all been explicitly written.
>
> Right now I have three simple vector classes - ranging from vector2d to
> vector4d - that are not templetized since I like the idea of being able to
> access coordinates directly by their name
>
> <snip>

You can use template specialization to let you access coordinates directly by name.
I.e., vector<1,float> has .x, vector<3,float> has .x/y/z, etc.

Geoffrey


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