Boost logo

Boost :

From: Theodore Papadopoulo (Theodore.Papadopoulo_at_[hidden])
Date: 2006-03-23 10:06:18


On Thu, 2006-03-23 at 14:33 +0000, Andy Little wrote:
>
> Would I be right in saying that only entities of the same dimension
> can be added
> so SpaceType and dimension can be alternatively be seen as a container
> rather
> than a parameter:
>
> Euclidean::N::Point
> Euclidean::N::Line
> Euclidean::N::SemiLine
> Euclidean::N::Segment
> Euclidean::N::Simplex
> Euclidean::N::Basis
>
> namespace Euclidean { namespace N{
>
> Point a = Point();
> a = Euclidean::N_plus_1::Point(); // Error !
> }}
>
> ???

No you are right.... And actually my own (not particularly interesting)
geometry library evolved as Geometry2D and Geometry3D namespaces
mimicking somewhat your view.
Unfortunately, I had to consider afterward higher dimensional geometries
and templated namespaces (sorry I'm introducing implementation details
here, which is clearly not the way I believe the discussion should
evolve) just do not exist yet (and I'm not sure they will ever be).
And after a while, you realize that templates (for this purpose at
least) are your friend, just for code sharing reasons....

That's why I favoured having the dimension as the last (templated)
parameter, because some implementations details can be shared.... But in
essence you are right, and if templated namespaces existed, I would have
preferred your organisation. Not that having the dimension last, does
not change the fact that you cannot assign an N+1 Point to an N point...

        Theo.


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