I am trying to construct a hash_map of values, key -> unique pointer, the code compiles fine. However on every execution I get an error from the STL about an access violation with iterators and I am not sure why.
The offending code looks like.
void AuthenticationRequestDelegator::registerAuthenticator(std::unique_ptr<IAuthenticator> authenticator)
{
Cred_t type = authenticator->getCredentialType();
m_authenticators.insert(AuthPair(type, std::move(authenticator)));
}
With an AuthPair defined as:
typedef std::pair<Cred_t, std::unique_ptr<IAuthenticator>> AuthPair;
The hash map is defined as:
typedef std::hash_map<Cred_t, std::unique_ptr<IAuthenticator>> AuthenticatorList;
AuthenticatorList m_authenticators;
Lastly the function (defn) in my header file looks like:
void registerAuthenticator(std::unique_ptr<IAuthenticator> authenticator);
The m_authenticators hash_map blows up every insert with an access violation. Any light would be appreciated.