Function StaticRingBuffer.secondSegment
Returns the wrapped continuation after firstSegment.
T[] secondSegment() scope nothrow @nogc @trusted;
const(T)[] secondSegment() scope const nothrow @nogc @trusted;
The returned slice borrows this buffer's inline storage and is empty whenever the logical sequence is physically contiguous.
Complexity
O(1).
Allocation
None.
Example
StaticRingBuffer!(int, 4) buffer;
assert(buffer .tryPushBack(10));
assert(buffer .tryPushBack(20));
assert(buffer .tryPushBack(30));
buffer .popFront();
buffer .popFront();
assert(buffer .tryPushBack(40));
assert(buffer .tryPushBack(50));
assert(buffer .tryPushBack(60));
assert(buffer .firstSegment == [30, 40]);
assert(buffer .secondSegment == [50, 60]);
buffer .secondSegment[0] = 51;
assert(buffer[2] == 51);