Boost logo

Geometry :

Subject: Re: [geometry] geometries design question: inheriting from STL containers
From: Tomislav Maric (tomislav.maric_at_[hidden])
Date: 2013-05-22 15:16:17


Hi Bruno,

thank you very much for your feedback, I really appreciate it! :)

Best regards,
Tomislav

On 05/22/2013 03:24 PM, Bruno Lalande wrote:
> Hi Tomislav,
>
> I have a question regarding the Ring model. How come it inherits
> from a
> (STL) Sequence?
> Inheriting from STL containers is said to be a problem because of the
> lack of a virtual destructor.
> However, this is only dangerous if you try to use dynamic polymorphism
> with a container, accessing
> the derived container member functions using a base class container
>
>
> Exactly, and that's not the intended use here. Inheritance is used for
> aliasing in this situation, as a convenient way to pull the public
> interface of the STL container. It's not intended to be used
> polymorphically. The documentation implicitly incurs that by not
> mentioning this implementation detail.
>
>
> , but
> why would anyone use
> pointers to containers?
>
>
> Outside of Boost.Geometry there's plenty of reasons to do that, but
> you are right to say that doing it with STL classes would be plain
> wrong. They are not intended to be extended this way.
>
> Bruno
>
>
> _______________________________________________
> Geometry mailing list
> Geometry_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/geometry



Geometry list run by mateusz at loskot.net