All tests done, just need the documentation and report
This commit is contained in:
@@ -33,9 +33,17 @@ public:
|
||||
|
||||
StackErr push(T val);
|
||||
|
||||
uint64_t size();
|
||||
|
||||
void print();
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
requires std::formattable<T, char>
|
||||
uint64_t Stack<T>::size() {
|
||||
return this->len;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
requires std::formattable<T, char>
|
||||
Stack<T>::Stack() {
|
||||
@@ -87,6 +95,7 @@ std::expected<T, StackErr> Stack<T>::pop() {
|
||||
}
|
||||
|
||||
T return_val = this->data[this->len - 1];
|
||||
this->len--;
|
||||
|
||||
if (this->cap / 4 > this->len) {
|
||||
uint64_t new_capacity = this->cap / 2;
|
||||
@@ -106,7 +115,7 @@ std::expected<T, StackErr> Stack<T>::pop() {
|
||||
this->data = tmp;
|
||||
this->cap = new_capacity;
|
||||
}
|
||||
|
||||
|
||||
return return_val;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user