Boost logo

Boost :

Subject: Re: [boost] static_vector using aligned_storage
From: Andrew Hundt (athundt_at_[hidden])
Date: 2012-12-12 13:11:37


Yes, I had proposed StaticVector.

Here is the repository:
https://github.com/ahundt/Boost.StaticVector

Here is a link to the original discussion via google groups:
https://groups.google.com/d/topic/boost-developers-archive/4n1QuJyKTTk/discussion

I would be interested in working with you to complete either my version or
yours. Did you have any thoughts or questions regarding my implementation?
There are a few items related to my implementation on the github ticket
list that came from the discussion thread that need resolving before the
next round, but nothing too bad.

Cheers!
Andrew Hundt

On Wed, Dec 12, 2012 at 11: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<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?
>
> If not, would you be so kind and see if my solution should work for
> any/most popular compiler/platform? I've tested it only on clang.
>
> To be specific, won't there be any problems with the memory aligmnent if I
> use this code for storage:
>
> boost::aligned_storage<sizeof(**Value) * Capacity> m_storage;
>
> this for access:
>
> *(reinterpret_cast<Value*>(m_**storage.address()) + i);
>
> and this for construction
>
> new
> (reinterpret_cast<Value*>(m_**storage.address()) + i)
> Value(value);
>
> Regards,
> Adam
>
> ______________________________**_________________
> Unsubscribe & other changes: http://lists.boost.org/**
> mailman/listinfo.cgi/boost<http://lists.boost.org/mailman/listinfo.cgi/boost>
>


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