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:
- 6:314f180362cb
- Parent:
- 5:0f65cdadb1a4
- Child:
- 7:6e24d8ccecd4
--- a/linearArray.hpp Wed Mar 08 10:48:34 2017 +0000
+++ b/linearArray.hpp Wed Mar 08 10:57:36 2017 +0000
@@ -16,28 +16,13 @@
if (elem_count < _array_size) {
if (_rear == _array_size - 1) _rear = -1;
_array[++_rear] = item;
- ret = elem_count++;
+ ret = _elem_count++;
}
return ret;
}
template<class type>
-type LinearArray<type>::pop() {
-
- type item = NULL;
-
- if (elem_count > 0) {
- item = _array[_front++];
- if (_front == _array_size) _front = 0;
- elem_count--;
- }
-
- return item;
-
-}
-
-template<class type>
type& LinearArray<type>::pop() {
type item = NULL;
@@ -45,20 +30,7 @@
if (elem_count > 0) {
item = _array[_front++];
if (_front == _array_size) _front = 0;
- elem_count--;
- }
-
- return item;
-
-}
-
-template<class type>
-type LinearArray<type>::peek() {
-
- type item = NULL;
-
- if (_front <= _rear) {
- item = _array[_front];
+ _elem_count--;
}
return item;
@@ -85,10 +57,10 @@
template<class type>
int LinearArray<type>::count() {
- return elem_count;
+ return _elem_count;
}
template<class type>
bool LinearArray<type>::full() {
- return elem_count == _array_size;
+ return _elem_count == _array_size;
}