I have a variable catch the output of a std::map::find()
call, and I wish to check whether or not anything was actually found (i.e. whether or not the iterator that was returned points to map.end()
).
//current_state.transitions is a std::map<std::string, std::vector<long>>
auto map_itr = current_state.transitions.find( std::string( 1, input_string.front() ) );
if ( map_itr == map_itr->second.end() ) {...} // Obviously not working.
I would think that since map_itr
and map_itr->second.end()
are both iterators, that I would be able to do some sort of comparison between them.
I've looked at the documentation for iterator
, map
, find
, etc. and cannot find anything.