Pavel Vozenilek wrote:
> "Jan Gaspar" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> I think, I changed mind. The flatten() method can be substituted by
>> something like this:
>>
>> void doSomething(const int* pInt, size_t numInts); // C API
>> circular_buffer<int> intBuffer(10);
>> ...
> //
>> fill the buffer somehow
>> vector<int> v(intBuffer.begin(), intBuffer.end());    // copy
>> if (!v.empty()) doSomething(&v[0], v.size());        // pass the
>> data to
> the API
>>
>> // &v[0] < &v[1] < ... < &v[n]
>>
>> I think, we should rather keep the interface minimal.
>>
> Yes but flatten() may be much more efficient, in some cases it may
> involve less or no copying at all and memory consumption won't be
> size() + capacity().

I suggest

T * circular_buffer<T>::data();

Postcondition: The elements of *this are now in the range [ r, r + size() ),
where r is the return value. Non-const operations on *this (except data())
may invalidate r.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to