[Development] New circular buffer container for Qt5

Sean Harmer sh at theharmers.co.uk
Fri Oct 28 15:45:21 CEST 2011


Hi,

On Friday 28 October 2011 15:30:45 Thiago Macieira wrote:
> On Friday, 28 de October de 2011 14:11:08 Sean Harmer wrote:
> > This class is similar to QVector but it provides circular semantics. For
> > example, appending to an already full circular buffer will overwrite the
> > oldest item i.e. it forms a kind of LRU cache. The API is essentially a
> > Qt'ified version of the boost::circular_buffer [1] API so hopefully
> > people will find it simple to use.
> 
> I'd like to see this API.

You can see the patch in this old MR (see qcircularbuffer.h):

https://qt.gitorious.org/qt/qtbase/merge_requests/60

If there is interest I'll submit it to gerrit using the new route for 
submission.
 
> > Appending and prepending are always O(1) operations which fills in a gap
> > in the performance characteristics offered by the existing Qt
> > containers.
> How does it implement copy-on-write semantics?

It uses QSharedData[Pointer].

Cheers,

Sean




More information about the Development mailing list