Boost logo

Geometry :

Subject: Re: [geometry] extensions
From: Barend Gehrels (barend_at_[hidden])
Date: 2012-03-04 09:52:52

Hi Kris,

On 9-2-2012 12:44, Krzysztof Czainski wrote:
> Like promised, I present a proposition of functions new_projection()
> and make_shared_projection(). They are useful, when:
> - you have a small set of types of projections you'll use,
> - you know the type of projection during it's creation, and later you
> want to use it through an abstract base pointer,
> - you want to avoid the overhead of factory: generating code for
> creating a projection of every type you don't use, and selecting the
> type from a string.

I think new_projection() is very useful. It wraps the call to the detail
virtual forwarding class which is definitely necessary. Also the new
typedefs are very useful, and make the new_projection (and other things)
very convenient to use.

Maybe we can put the first version (with specific parameters) into
detail, and keep only the most simple version for users.

The make_shared_projection will also be useful for some, but I find it a
bit of an overkill - make_shared was defined to avoid "new" calls (if I
understand correctly) but here is not really a call to new. So
shared_ptr<ProjA> ptr;

would perfectly do the job.

So I'm not sure if it is that useful for the library itself. Any
opinions here?

I've not committed the changes yet - will do that tomorrow or so, at
least the types and new_ version, and I created an example of it. That
example conveniently makes conveniently use of the new typedefs.

Thanks for your contributions!

Geometry list run by mateusz at