Boost logo

Geometry :

Subject: [ggl] Derived classes and traits
From: vd (zedxz2)
Date: 2011-08-20 03:40:22

Hello, I am starting to play with bg and I want to derive/abstract a couple
of things using it.

For example, a derived point class:

namespace bg = boost::geometry;

template <typename CoordinateType, std::size_t DimensionCount, typename
class MyPointType : public bg::model::point<CoordinateType, DimensionCount,
CoordinateSystem >
  // Add possible new functionality here.

typedef MyPointType<int32_t, 2, bg::cs::cartesian> MyIntPoint2;
typedef MyPointType<int32_t, 3, bg::cs::cartesian> MyIntPoint3;

This works fine. However, when trying to derive one more level, I'm facing a

class SomethingDerivedAgain : MyIntPoint3
  SomethingDerivedAgain(...) // How to access MyIntPoint3's CoordinateType
(abstractly of course, without assuming it's int32_t) so that I can override
the (v0,v1,v2) constructor of bg::model::point ??

 // Incredible new stuff here

Would "traits" help me achieve this ? Could you provide a snippet of usage
example ? That would be very appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...

Geometry list run by mateusz at