Problems with iterators
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 19

Thread: Problems with iterators

Threaded View

  1. #7
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,266

    Re: Problems with iterators

    Quote Originally Posted by Paul McKenzie View Post
    At one of my jobs, the programmers there were doing basically the same thing as the OP. They could never figure out how to erase from a vector while looping -- you should have seen the creative ways that were done, all would eventually fail. Things like jumping over invalidated iterators, reseating the iterator, all sorts of things that made it a nightmare to maintain and work consistently.

    I introduced them to std:artition() and erase(), and all of those problems that were plaguing that part of the code (for months) became resolved in less than 5 minutes.
    ...and the moral of the story is to know your STL algorithms!

    PS I wish that c++ tutors and books would remember the STL and give all of it the coverage it deserves - not just vectors, maps and i/o streams if you're lucky.
    Last edited by 2kaud; January 21st, 2014 at 11:59 AM.
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center