Boost logo

Geometry :

Subject: Re: [geometry] Default model for Ring Concept should *be* Container, not inherit from it
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2012-02-15 12:36:02


On 15 February 2012 16:58, Volker Schöch <vschoech_at_[hidden]> wrote:
>
> I wonder why you bothered to make boost::geometry::model::ring a type of its own, merely wrapping the Container type.

Even if it wasn't wrap, it would be a standard-compliant sequence type
with random access anyway.

> Some say that inheriting from an STL type is practically always a bad idea,
> and the same rationale applies here.

Yes and now, unless you want to raise a praticular issue.
However, I personally agree it is potentially a bad idea to inherit publicly.
The ring could inherit privately (be composit of) and declare
necessary interface
delegating to the actual implementation.

> 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

https://gist.github.com/1837500

BTW, _TPolygon does not feel like a C++ standard-kosher identifier.

> (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.)

I believe nobody is puzzled.
Unless pre-move semantic compiler is required, this is fairly natural
approach nowadays.

Best regards,

--
Mateusz Loskot, http://mateusz.loskot.net

Geometry list run by mateusz at loskot.net