Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: linearArray.hpp
- Revision:
- 8:18c9d62b8f7c
- Parent:
- 7:6e24d8ccecd4
- Child:
- 11:1e27a6f0b0cf
--- a/linearArray.hpp Wed Mar 08 10:59:06 2017 +0000
+++ b/linearArray.hpp Wed Mar 08 11:23:22 2017 +0000
@@ -13,7 +13,13 @@
int LinearArray<type>::push(type item) {
int ret = -1;
- if (_elem_count < _array_size) {
+ bool room = _elem_count < _array_size;
+ if (!room && _forced) {
+ if (++_front == _array_size) _front = 0;
+ _elem_count--;
+ room = true;
+ }
+ if (room) {
if (_rear == _array_size - 1) _rear = -1;
_array[++_rear] = item;
ret = _elem_count++;