I'm making a linked list class and I want a convenient default argument for my 'remove()' function.
int size() { return size_; }
int remove(int index = size() - 1);
^[C2352]
This gives me an error a call of a non-static member function requires an object, so I tried
int remove(int index = this->size() - 1);
However the this keyword cannot be used outside of a function. I want to avoid making size_ a public variable, for safety reasons. Note that my class is a template class.
I would appreciate any help for finding a solution for this.