Opened 4 years ago

Last modified 4 years ago

#11399 new Feature Requests

Boost geometry models don't support stateful allocator.

Reported by: bmccart@… Owned by: Barend Gehrels
Milestone: To Be Determined Component: geometry
Version: Boost 1.57.0 Severity: Problem
Keywords: geometry model allocator Cc:


The following model class declarations don't contain constructors that take a copy of the allocator types: linestring multi_linestring polygon multi_polygon

This makes it impossible to use stateful allocators with geometry models.

Change History (2)

comment:1 Changed 4 years ago by awulkiew

Indeed, you're right that modern allocator support is missing.

Unfortunately when the models were implemented in the past some design decisions were made, i.e. the allocators are passed as template template parameters. If we want to be backward compatibile we must leave it as it is. So even if it was allowed to pass stateful allocators objects into the constructor the user would be able to use only the allocators taking one type parameter. I'm not sure if that'd be useful in general. Would it meet your needs?

If we wanted to support modern allocators we would have to reimplement the existing models which would be a breaking change. Maybe this wouldn't be that bad because I guess the majority of the users doesn't specify the internal containers or allocators at all. Or we could implement additional models existing aside from the ones we have now or enable ones or the others with a macro definition. None of these solutions is perfect.

Last but not least, Boost.Geometry is generic. The user can implement his own geometry types with ctors taking allocators or whatever he likes and adapt these types to Boost.Geometry concepts. So I'm not sure if this change is needed, though indeed the models could be modernized.

comment:2 Changed 4 years ago by anonymous

Since you don't want to break backwards compatibility on the template-template parameter for allocator I can make due with my own geometry type.

Note: See TracTickets for help on using tickets.