Queue_Array class containing the main data and also index of head and tail of the array.
More...
|
void | enqueue (const int16_t &) |
| Add element to the first of the queue.
|
|
int | dequeue () |
| Delete element from back of the queue.
|
|
void | display () const |
| Show all saved data.
|
|
Queue_Array class containing the main data and also index of head and tail of the array.
◆ dequeue()
int data_structures::queue_using_array::Queue_Array::dequeue |
( |
| ) |
|
Delete element from back of the queue.
Remove element that is located at the first of the queue.
- Returns
- data that is deleted if queue is not empty
75 {
76 int8_t d{0};
79 return 0;
83 } else {
85 }
86
87 return d;
88}
int8_t front
Index of head of the array.
Definition queue_using_array.cpp:49
int8_t rear
Index of tail of the array.
Definition queue_using_array.cpp:50
std::array< int16_t, max_size > arr
All stored data.
Definition queue_using_array.cpp:51
◆ display()
void data_structures::queue_using_array::Queue_Array::display |
( |
| ) |
const |
Show all saved data.
Utility function to show all elements in the queue.
93 {
96 } else {
98 }
99}
◆ enqueue()
void data_structures::queue_using_array::Queue_Array::enqueue |
( |
const int16_t & | ele | ) |
|
Add element to the first of the queue.
Adds new element to the end of the queue.
- Parameters
-
ele | to be added to the end of the queue |
◆ arr
◆ front
int8_t data_structures::queue_using_array::Queue_Array::front {-1} |
|
private |
Index of head of the array.
◆ rear
int8_t data_structures::queue_using_array::Queue_Array::rear {-1} |
|
private |
Index of tail of the array.
The documentation for this class was generated from the following file: