> there are no iterators.
I don't think a lock free container can support a general purpose iteration scheme. That would require a locking mechanism on the hole queue, which basically defeats its purpose.
Basically, atomicity of operations are provided only for the queue's ends, but the elements in between are not themselves atomic types (this couldn't work neither, because atomic types are not Copyable nor Moveable). Lock free algorithms normally operate with a constant set of atomic objects (only one for an spsc queue, if I remember correctly) that orders memory transactions of other memory locations. For lock free queues, the atomic access is provided for both ends.
If iterators were provided, then accessing the elements in between would incur a race condition.
In short, I don't think it is theoretically possible.
Julien V.
On August 3, 2023 7:05:49 p.m. EDT, Phil Bouchard via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
On 8/3/23 18:36, Phil Bouchard via Std-Proposals wrote:
Oh but its API is very limited... there are no iterators.