All tests done, just need the documentation and report

This commit is contained in:
2026-03-17 15:49:55 -06:00
parent c56cc5dca2
commit c06a6aab4b
2 changed files with 62 additions and 1 deletions

View File

@@ -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;
}