Boost logo

Boost :

From: Jan Gaspar (jga_at_[hidden])
Date: 2003-07-23 04:17:45


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.

Jan

Pavel Vozenilek wrote:

> Would it be possible to add helper function 'flatten()' into
> circular_buffer?
>
> After invocation, user would be sure of:
>
> &buff[0] < &buff[1] < ... < &buff[n]
>
> In other words, user will be able to treat circular_buffer content as
> continuous array of values in this moment.
>
> It is not earth shaking feature, it violates 'minimal interface' ideal but
> can be handy:
> - when legacy C function requires continuous array (like Win32 API)
> - when buffer is being saved to file or written to socket
> - special purpose adaptor could present result as (nonresizable) vector<>
>
> Alternatives are simple but much more CPU/memory expensive.
>
> /Pavel
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

--
Jan Gaspar | jga_at_[hidden]
Whitestein Technologies | www.whitestein.com
Panenska 28 | SK-81103 Bratislava | Slovak Republic
Tel +421(2)5930-0735 | Fax +421(2)5443-5512

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