Skip to content

Commit 4168b34

Browse files
make a span version of pop
1 parent 821c9fc commit 4168b34

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

platform/include/platform/CircularBuffer.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,20 @@ class CircularBuffer {
260260
return pop(dest, N);
261261
}
262262

263+
/**
264+
* Pop multiple elements from the buffer.
265+
*
266+
* @param dest The array which will receive the elements.
267+
*
268+
* @return The number of elements popped.
269+
*/
270+
CounterType pop(mbed::Span<T>& dest)
271+
{
272+
CounterType popped = pop(dest.data(), dest.size());
273+
dest = mbed::make_Span(dest.data(), popped);
274+
return popped;
275+
}
276+
263277
/** Check if the buffer is empty.
264278
*
265279
* @return True if the buffer is empty, false if not.

0 commit comments

Comments
 (0)