empty function, is this correct?

How can the empty() function determine whether the doubly linked list is empty?

The empty() function checks if the header sentinel's next pointer points to the trailer.
What is "header sentinel"?
What is "next of sentinel"?
What is "trailer"?

I don't think that your answer is quite right. It depends on the answers to the above questions.


Do note that an implementation of a type (like a list) can use caching ; gain performance in some operations by use of extra memory and work. In this case the list could have and maintain an integer value "size" that member functions like size() and empty() can use rather than iterating over the list.
Adding member "size" requires changes to many member functions of the list.
Topic archived. No new replies allowed.