Run Code  | Code Wall  | Users  | Misc  | Feedback  | About  | Login  | Theme  | Privacy 

You can't erase a std::unordered_map::local_iterator

Language: Layout:
+ ] Compiler args + ] Show input
Compilation time: 0.42 sec, absolute service time: 0,6 sec 
fork mode |  history  | discussion
Error(s):
source_file.cpp:7:7: error: no matching member function for call to 'erase'
    m.erase(p);
    ~~^~~~~
/usr/include/c++/v1/unordered_map:1118:14: note: candidate function not viable: no known conversion from 'std::__1::__hash_map_iterator<std::__1::__hash_local_iterator<std::__1::__hash_node<std::__1::__hash_value_type<int, int>, void *> *> >' to 'const_iterator' (aka '__hash_map_const_iterator<__hash_const_iterator<std::__1::__hash_node<std::__1::__hash_value_type<int, int>, void *> *> >') for 1st argument
    iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);}
             ^
/usr/include/c++/v1/unordered_map:1120:14: note: candidate function not viable: no known conversion from '__hash_map_iterator<std::__1::__hash_local_iterator<std::__1::__hash_node<std::__1::__hash_value_type<int, int>, void *> *>>' to '__hash_map_iterator<typename __table::iterator>' for 1st argument
    iterator erase(iterator __p)       {return __table_.erase(__p.__i_);}
             ^
/usr/include/c++/v1/unordered_map:1122:15: note: candidate function not viable: no known conversion from 'std::__1::__hash_map_iterator<std::__1::__hash_local_iterator<std::__1::__hash_node<std::__1::__hash_value_type<int, int>, void *> *> >' to 'const key_type' (aka 'const int') for 1st argument
    size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
              ^
/usr/include/c++/v1/unordered_map:1124:14: note: candidate function not viable: requires 2 arguments, but 1 was provided
    iterator erase(const_iterator __first, const_iterator __last)
             ^
1 error generated.