head tail figure an empty doubly linked list with header and tail nodes keyword is not neededbut you will often see it and it is commonly used by programmers to signify type that contains mostly data that are accessed directlyrather than through methods in our casemaking the members public in the node class will not be problemsince the node class is itself private and inaccessible outside of the list class at line we see the beginning of the declaration of the public nested const_iterator classand at line we see the beginning of the declaration of the public nested iterator class the unusual syntax is inheritancewhich is powerful construct not otherwise used in the book the inheritance syntax states that iterator has exactly the same functionality as const_iteratorwith possibly some additionsand that iterator is type-compatible with const_iterator and can be used wherever const_iterator is needed we'll discuss those details when we see the actual implementations later lines to contain the data members for listnamelythe pointers to the header and tail nodes we also keep track of the size in data member so that the size method can be implemented in constant time the rest of the list class consists of the constructorthe big-fiveand host of methods many of the methods are one-liners begin and end return appropriate iteratorsthe call at line is typical of the implementationin which we return constructed iterator (thus the iterator and const_iterator classes each have constructor that takes pointer to node as its parameterthe clear method at lines to works by repeatedly removing items until the list is empty using this strategy allows clear to avoid getting its hands dirty reclaiming nodes because the node reclamation is now funneled to pop_front the methods at lines to all work by cleverly obtaining and using an appropriate iterator recall that the insert method inserts prior to positionso push_back inserts prior to the endmarkeras required in pop_backnote that erase(-end()creates temporary iterator corresponding to the endmarkerretreats the temporary iteratorand uses that iterator to erase similar behavior occurs in back note also that in the case of the pop_front and pop_back operationswe again avoid dealing with node reclamation figure shows the node classconsisting of the stored itempointers to the previous and next nodeand constructor all the data members are public figure shows the const_iterator classand figure shows the iterator class as we mentioned earlierthe syntax at line in figure indicates an advanced feature known as inheritance and means that iterator is- const_iterator when the iterator class is written this wayit inherits all the data and methods from const_iterator it may then add new dataadd new methodsand override ( redefineexisting methods in the most general scenariothere is significant syntactical baggage (often resulting in the keyword virtual appearing in the code