[boost] trait register on derived class

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[boost] trait register on derived class

Lechuan Xue
Hi,

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?

Thanks,
Leo Xue
_______________________________________________
Geometry mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/geometry

boost_geometry.patch (6K) Download Attachment