m.find(...) == m.end() - which is used, iterator or const_iterator

Posted by leeeroy on Stack Overflow See other posts from Stack Overflow or by leeeroy
Published on 2010-04-13T19:18:07Z Indexed on 2010/04/13 19:23 UTC
Read the original article Hit count: 162

Filed under:
|
|

std::map find/end both provides const_iterator and iterator, e.g.

  iterator end ();
  const_iterator end () const

Out of curiosity,if I have a std::map , which will be called/compared here, an iterator or a const_iterator ? :

if(m.find(key) != m.end()) {
   ...
}

And should I care ?

© Stack Overflow or respective owner

Related posts about c++

Related posts about templates