1
This commit is contained in:
2022-07-19 00:15:02 +02:00
parent d2401820c7
commit 99f60383ee
2 changed files with 7 additions and 4 deletions

View File

@ -23,10 +23,12 @@ private:
static constexpr const std::size_t min_cap = 5; // Slots to allocate extra when array full
std::unique_ptr<Type[]> buf; // Heap allocated as size needs to change during runtime
// Can't use Array for same reason so we use a C Style array
// NOTE: Because unique_ptr to an array doesn't implement operator*
// I used *buf.get() everywhere, I think it's probably not supposed
// to be used for something like this?
// Can't use Array for the same reason so we use a C Style array
// NOTE: Normally I wouldn't use smart pointers for low level data structers
// but in this case it's ok as buf doesn't change often
// and the unique_ptr basically has no overhead.
// At least I didn't have to write any of the 3 deletes that would
// be necessary otherwise ¯\_(ツ)_/¯
std::size_t buf_pos = 0;
std::size_t buf_cap = 0;

View File

@ -29,6 +29,7 @@ public:
LinkedListIterator(Type* ptr) : Iterator<T>(ptr) {}
// Allow the iterator to traverse the links
LinkedListIterator& operator++() override {
// ptr is of type Wrapper<T>*
this->ptr = this->ptr->next;