CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #3
    Join Date
    Jul 2013
    Posts
    576

    Re: How to get the address of 1st node in <list>

    Quote Originally Posted by tush123 View Post
    Reversing Linklist using Stack.
    The STL containers don't give you access to implementation detail like say internal pointers.

    What you could do is push the elements on stack, clear the list, and then rebuild it with the elements in reverse order.

    A more efficient way would be to use one forward iterator and one reverse iterator to swap the list elements pairwise until the iterators meet in the middle.

    Also note that std::list has a reverse function already.
    Last edited by razzle; May 17th, 2015 at 01:37 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured