So for my first question. I'm working on a project and I need my constructor to create an empty linked list. Would this be correct?
// member variables
private:
node* headptr;
size_type howmany;
//constructor
SuperList::SuperList(){
headptr = NULL; //does this create an empty list?
howmany = 0; //counts how many nodes are in the list
}
Second question. I need to create a isEmpty() function and a isFull() function. For the isEmpty() function I just see if howmany == 0, right? But to check if list is FULL how would I do that? For normal arrays there is a CAPACITY, but there is no capacity given for linked lists.
//these are the specifications I was given for the isFull function
Effect: Determines if this list is full
Precondition: NONE
Postcondition: this object is unchanged
Returns: true if it is not possible to allocate any more memory, false otherwise
bool SuperList::isFull() const
std::numeric_limits<size_type>::max()? I would not bothervoid* list = nullptr. It's when you want to be able to add stuff to it that it gets [more] complicated.