Boost logo

Boost Users :

Subject: Re: [Boost-users] Is there a self contained vector-like container?
From: Marshall Clow (mclow.lists_at_[hidden])
Date: 2012-03-01 16:05:52


On Mar 1, 2012, at 12:13 PM, Frank Birbacher wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi!
>
> Is there in Boost a container that is statically "max sized" and
> contains its own storage like a std::array, but manages a size and can
> construct and destruct elements. I guess it would look something like:
>
> template<typedef T, size_t N>
> struct self_contained_vector
> {
> size_t max_size() const { return N; }
> size_t size() const { return size_; }
> private:
> size_t size_;
> aligned_storage<T> data_[N];
>
> //...implement random access container...
> };

I've written one of these; I'm thinking about adding it to Boost.Array.
I have to write tests and docs, though.

-- 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-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net