std::unordered_map iterator

Mar 9, 2019 at 8:25am
Hello Forum,

I have an "unordered_map" variable. I use its function "find()". I want to put its return value into another variable.

1
2
3
  std::unordered_map<DWORD, std::string> map;

std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<unsigned long const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > i = map.find(SomeValue);


That is a very long unreadable definition of "i". Is there another way to define the variable "i"? Without "auto".

Thank you.


Mar 9, 2019 at 8:30am
You can find the return type of the standard library functions on a reference page of your choice. cppreference has a deservedly good reputation:

https://en.cppreference.com/w/cpp/container/unordered_map/find


Mar 10, 2019 at 7:30am
Hello,

I found the following method:

std::unordered_map<DWORD, std::string>::const_iterator i;

Thank you.
Topic archived. No new replies allowed.