Boost logo

Boost :

From: Michael Fawcett (michael.fawcett_at_[hidden])
Date: 2007-10-05 13:45:24


On 10/5/07, John Femiani <JOHN.FEMIANI_at_[hidden]> wrote:
> If we want boost to have a point class I think it will really have to be
> a set of point adapters and point concepts that work for existing types.
> There are too many points out there that we would have to interact with,
> both outside of boost and also within boost. For instance it would be
> nice if algorithms worked with both Boost.Point and the CGAL point.

I suggested something similar to this during a review (either Andy
Little's Quan, or Boost.Units, I can't remember). For example, a
Boost dot_product could be implemented as such:

// Note: *SomethingDeducedHere* would be some BOOST_TYPEOF magic
template <typename LHS, typename RHS>
*SomethingDeducedHere* dot_product(const LHS &lhs, const RHS &rhs)
{
   return get<0>(lhs) * get<0>(rhs) + get<1>(lhs) * get<1>(rhs) +
get<2>(lhs) * get<2>(rhs);
}

Basically, just assume the point type acts like a tuple or Fusion
sequence. Then all the algorithms written can be used with any point
class (with a little work in some cases).

--Michael Fawcett


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