end() returns an iterator to one past the end of the list. Assuming you know the list is not empty, you could use *(--end()), but a more clear solution might be to use front() and back() which actually return references to the values in the list instead of iterators:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.