From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2008-05-01 23:09:32
After this morning's discussion I implemented what I've had in mind to
make the implementation of my library standard generic programming. It
is just a demonstration of the GP interfaces I have in mind, and is
pretty simple. I define a point, interval, point_3d and rectangle
concepts and use them with each other. For example the point_3d is also
a model for point_2d, and I use it that way, and the rectangle interface
is implemented in terms of the interval. The coordinate type is
templated everywhere and I use that fact to demonstrate the
compatibility that enables between geometry objects with different
coordinate data types.
Near the end I show how a made up layout object data type, that has the
four coordinates of a rectangle as part of its member data, can be made
to model the rectangle concept by providing a specialization of
rectangle_traits for it and then I use it with another rectangle type
with different coordinate type.
Please feel free to critique the code. I want to make sure I've got
everything right before I rewrite the library.