Subject: Re: [boost] embedded_vector
From: Tim Blechmann (tim_at_[hidden])
Date: 2010-02-09 08:25:57
>>>>> [...] 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.
i cannot comment on c++03, since i don't have access to the iso
specification, but for c++0x it seems to be the case. n2800 tells me the
The elements of a vector are stored contiguously, meaning that if v is a
vector<T, Alloc> where T is some type other than bool, then it obeys the
identity &v[n] == &v + n for all 0 <= n < v.size().
in addition to that, 184.108.40.206 defines:
const_pointer data() const;
these two paragraphs would give me the guaranties, that i need for my
>> 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;
> See also here for a lib in the review queue:
interesting ... for EmbeddedSize==0 or
StackBufferPolicy==boost::store_n_objects<0> both implementations would
match the guaranties of my class ...
-- tim_at_[hidden] http://tim.klingt.org Silence is only frightening to people who are compulsively verbalizing. William S. Burroughs
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk