
On Thu, May 1, 2008 at 8:41 AM, Bruno Lalande <bruno.lalande@gmail.com> wrote:
The point concept of Barend's library doesn't require any x() or y() member functions. The fact that the library proposes 2 predefined point classes, point_xy and point_ll, can be a bit confusing but don't be fooled: they do *not* represent the point concept, they are only 2 classes that satisfy it. The point concept uses accessors of this kind :
template <int I> value() const;
Could you just specialize boost::get?
In the second preview of the library, there was also runtime indexing accessors, but they should disappear to only have compile-time accessors as shown above (I'm currently working on this with Barend).
Also, the point concept as currently defined might be replaced by a point_traits class usable the same way as what you propose with your point_interface<T>. It gives something like : point_traits<T>::value<0>(p) to have the first coordinate of a point p. The point concept would then follow the exact definition just given by Phil. Not sure yet this will be done, but it brings a lot of advantages (non-intrusiveness, possibility of using native arrays as points, ...).
That's a very big advantage. What about using boost::tuples? boost::get gives you these things with a common syntax. I believe that ideally, the compile-time indexable point concept should support the boost::get syntax, and the run-time version (for looping over members) should support array access. --Michael Fawcett