Boost logo

Geometry :

Subject: [geometry] [boost] trait register on derived class
From: Lechuan Xue (lcxue_at_[hidden])
Date: 2015-08-21 17:54:37


Currently, if I have one custom geometry and a few further derived custom geometries, I need to do trait register on all of them. Like:

class derived_point1 : public base_point {};
class derived_point2 : public base_point1 {};

namespace boost { namespace geometry { namespace traits {
    template<> struct tag<base_point> { typedef point_tag type; };
    template<> struct tag<derived_point1> { typedef point_tag type; };
    template<> struct tag<derived_point2> { typedef point_tag type; };

What I want is to register all custom geometries in one step. Like:

    template<typename T>
    struct tag<T, typename std::enable_if<std::is_base_of<base_point, T>()>::type> {
        typedef point_tag type;

To do that, I need to add a dummy template type to all the trait classes to enable SFINAE. Attached is the patch (based on boost 1.57.0_1). Is this something we can consider?

Leo Xue

Geometry list run by mateusz at