listsstacksand queues protectedconst list *thelistnode *currentconst_iteratorconst list lstnode * thelist&lst }currentp void assertisvalidconst ifthelist =nullptr |current =nullptr |current =thelist->head throw iteratoroutofboundsexception}figure revised protected section of const_iterator that incorporates ability to perform additional error checks we will sketch the basic idea and leave the details as an exercise in the const_iterator classwe add pointer to the list and modify the protected constructor to take the list as parameter we can also add methods that throw an exception if certain assertions aren' met the revised protected section looks something like the code in figure then all calls to iterator and const_iterator constructors that formerly took one parameter now take twoas in the begin method for listconst_iterator beginconst const_iterator itr*thishead }return ++itrthen insert can be revised to look something like the code in figure we leave the details of these modifications as an exercise /insert before itr iterator insertiterator itrconst object itr assertisvalid)ifitr thelist !this throw iteratormismatchexception}node * itr currentthesize++return *thisp->prev ->prev->next new nodexp->prevp }figure list insert with additional error checks