Boost logo

Boost :

Subject: Re: [boost] static_vector using aligned_storage
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2012-12-12 11:49:38


Marshall Clow wrote:
> On Dec 12, 2012, at 8:08 AM, Adam Wulkiewicz <adam.wulkiewicz_at_[hidden]> wrote:
>
>> Hi,
>>
>> I'm developing R-tree container for Boost.Geometry. To keep it short, there are containers of Values in leaf nodes. Those containers must have push_back() functionality. For static-size nodes I'm using a container based on boost::array. Unfortunately this means that default constructors of stored Values are called when the container is created. I'd like not to expect that Values have their default ctor implemented. I've implemented an alternative container using boost::aligned_storage. This is just a proof of concept. The code is available here:
>>
>> https://svn.boost.org/svn/boost/sandbox-branches/geometry/index/tests/static_vector.cpp
>>
>> I've searched for this kind of container in Boost since I remember that someone proposed it some time ago but didn't find it anywhere. Is it released somewhere? Maby as a part of some library?
>
> As far as I know, there isn't one in Boost.
> I wrote one once, but never submitted it for review.
>
> BTW, you're missing a bunch of stuff that needs to be there: iterator support, exception safety, swap, etc.

As I've written, it's a proof of concept no a ready container, but
implemented operations are safe.

I don't see a way to implement non-throwing swap since I don't want to
use some external storage. So swap probably won't be implemented - just
copy.

Regards,
Adam


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk