Boost logo

Boost :

From: Geoff Carlton (gcarlton_at_[hidden])
Date: 2005-06-29 21:21:49


Hickerson, David A wrote:
> I have done some of this in the library I wrote in 97.

I'd be curious to see that. I'd like a simple, common set of geom
classes.

The concept of these traits is a very interesting and clever one, but I
don't think its useful in practice. You'd want a simple set of classes,
and if they are generically useful then the conversion to library
variants is simple: either construct a new temporary, or even a
straight reinterpret_cast for performance.

In particular, the basics are:

1.) Easy definition
Preferably:
   class point2i; // descended from point2<int>
   void DoSomething(const point2i& mypoint);

Alternatively:
   template<class T>
   class point2;

   typedef point2<int> mypoint2i;

   void DoSomething(const point2i& mypoint);

2.) Easy instantiation
Definitely:
   point2i pos(1,2);
Ideally (somehow):
   point2i pos2[2] = { { 3, 4 }, { 5, 6 } };

3.) Very clear class layout
So we can know when reinterpreting the object is possible.

4.) Minimum of templates and macros
Want this to be compile-able across the board, and simple to understand.

5.) Basic methods in class
Length(), LengthSq(), Normalise(), etc

6.) Set of algorithm functions to operate on these types
Similar to STL, a separate group of functions.

Having written all this, its hard to go past the MagicSoftware library.
  It defines many basic primitives and then a whole lot of useful
operating functions. Hmm.. I should probably just use that in the
future. :)

Geoff


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