Boost logo

Boost Users :

Subject: [Boost-users] circular_buffer: rotate() vs erase_begin() for scalars
From: Robert Dailey (rcdailey.lists_at_[hidden])
Date: 2017-01-18 13:00:10


I'm using circular_buffer to represent a FIFO queue of bytes:

boost::circular_buffer<std::uint8_t> m_queue;

When I read bytes from the "front", I simply do:

m_queue.erase_begin(num_read_bytes);

I do so because the documentation for erase_begin() specifically
mentions constant time performance for scalar types since no
destructor needs to be called.

However, I feel that rotate() better expresses what I'm trying to do.
Is there a reason to prefer one over the other for scalar types?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net