Boost logo

Boost :

Subject: Re: [boost] static_vector using aligned_storage
From: Marshall Clow (mclow.lists_at_[hidden])
Date: 2012-12-12 11:22:43


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.

This is supposed to be easy in C++11, with the appropriate allocator.
[ I say "supposed to be" since I haven't tried it. ]

-- Marshall

Marshall Clow Idio Software <mailto:mclow.lists_at_[hidden]>

A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
        -- Yu Suzuki


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