Boost logo

Boost :

From: Pavel Vozenilek (pavel_vozenilek_at_[hidden])
Date: 2003-07-23 04:33:27


"Jan Gaspar" <jga_at_[hidden]> wrote in message
news:3F1E52B9.7E50FE9_at_whitestein.com...
> 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().

/Pavel


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