Boost logo

Geometry :

Subject: Re: [geometry] Default model for Ring Concept should *be* Container, not inherit from it
From: Barend Gehrels (barend_at_[hidden])
Date: 2012-02-15 13:30:50


Hi Volker,

On 15-2-2012 17:58, Volker Schöch wrote:
>
> Hi again,
>
> I wonder why you bothered to make boost::geometry::model::ring a type
> of its own, merely wrapping the Container type.
>

See it as a template typedef. Which are not possible in the pre-C++11 era.

Therefore we simply derived. Not just here, also linestring, multi*

Now in C++11 it is (maybe) possible. I'm not really sure if the template
alias gives you possibilites for specialization. Did not try yet. Is an
alias named ring such different from a similar alias named linestring
that you can make two specializations? Don't know that.

> It does not have any methods or members of its own. Some say that
> inheriting from an STL type is practically always a bad idea, and the
> same rationale applies here.
>

Yes, this discussion has been earlier on this list (or another). Some
people are really principal about this. However I did find at that time
that it occurs more in Boost.

> I am not being pedantic, here is my case in point. The current
> implementation requires some ugly syntantic hacking to achieve a very
> simple and natural thing:
>
> http://codepad.org/qASAKH8R
>
> (If you are puzzled by my passing a vector by value, you might want to
> read http://cpp-next.com/archive/2009/08/want-speed-pass-by-value/ by
> Dave Abrahams.)
>
> Maybe that's something to consider for a future version. At the
> surface, it doesn't look like a change that has many implications on
> existing code. I assume this could be relatively easily fixed.
>

I'm indeed puzzled ;-) The TPolygon is derived from a vector of polygon?
Besides that I don't understand that, is that not doing a similar thing
as we did? Or is this a show how it should not be? Maybe I miss the point.

Regards, Barend



Geometry list run by mateusz at loskot.net