Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Constructing a const_iterator can throw

I have a STL unordered_map, MyMap, of the type

unordered_map<const MyClass*, unordered_map<SomeOtherClass, std::shared_ptr<YetAnotherClass>>> 

When I construct a const_iterator of the container on the stack, I'm getting a warning that it can throw.

marked as noexcept, but calls throwing function 'std::_List_const_iterator,std::hash,std::equal_to,HeapAllocator > > > > > > >::{ctor}

I'm wondering why is that? An iterator is effectively a pointer. I'm only constructing it on the stack

MyMap::const_iterator myMapIterator;

I'm not even assigning it =, just constructing it. I pass it in by reference to another method to actually hydrate the iterator.

Interested to know what's going on.

Thanks

Comments