Boost logo

Boost :

Subject: Re: [boost] embedded_vector
From: Hansjoerg (hansipet_at_[hidden])
Date: 2010-02-09 05:30:43

Am 09.02.2010 11:09, schrieb strasser_at_[hidden]:
> Zitat von Tim Blechmann <tim_at_[hidden]>:
>>>> [...] in contrary to std::vector, which is only required to
>>>> support random-access iterators (which are implementation-defined), my
>>>> class guaranties to allocate the data in one consecutive memory
>>>> area. [...]
>>> As of C++03, std::vector is contiguous, so I'm not convinced by the
>>> utility of this.
>> interesting ... it seems, my assumption was based on c++98
> I don't think that was changed from 98 to 03.
> but your description reminded me of something I do think would be a
> useful addition to Boost.Array.
> a vector that resides on the stack as long as it fits in there(like a
> boost::array) but still supports dynamic allocation in case the vector
> size exceeds the reserved space.
> my implementation of this:
> template<class T,std::size_t EmbeddedSize,bool Expand=true>
> class embedded_vector;
> embedded_vector<T,Size,false> should be equivalent to
> boost::array<T,Size>, but if Expand==true max_size() is unlimited, with
> no allocation as long as size() <= EmbeddedSize

I think the problem of std::vector is that it can be moved if objects
are assigned (more than the buffer allows)

Boost list run by bdawes at, gregod at, cpdaniel at, john at