locked
Is Iterator in Map RRS feed

  • Question

  • I was wondering is there a standard fast way to determine if an map::iterator is referencing a particular map? Is the map referenced somehow in the iterator or only the element in the iterator? I ask because I am storing a list of map iterators from various maps (of the same type) and I need to know which map each iterator is pointing to.

    Thank you
    Joseph 
    Wednesday, July 22, 2009 10:04 PM

Answers

  • No.  Storing iterators is an iffy thing to do.  Consider pair<>.

    Hans Passant.
    • Marked as answer by JoeLittle Wednesday, July 22, 2009 10:36 PM
    Wednesday, July 22, 2009 10:26 PM
  • Nope. You are best to come up with something creative on your own.

    • Marked as answer by JoeLittle Wednesday, July 22, 2009 10:36 PM
    Wednesday, July 22, 2009 10:31 PM

All replies

  • No.  Storing iterators is an iffy thing to do.  Consider pair<>.

    Hans Passant.
    • Marked as answer by JoeLittle Wednesday, July 22, 2009 10:36 PM
    Wednesday, July 22, 2009 10:26 PM
  • Nope. You are best to come up with something creative on your own.

    • Marked as answer by JoeLittle Wednesday, July 22, 2009 10:36 PM
    Wednesday, July 22, 2009 10:31 PM