Unable to use std::shared_ptr as value type in std::map?

c++11, dictionary, shared-ptr

Solution

`std::make_pair` isn't intended to be used with explicit template parameters. Just leave them off:

auto my_pair = std::make_pair(hash32_t(image->name), texture);

NOTE: the call to make_shared is wrong as well. The parameters are passed to the constructor of `texture_t`, so in this case it would just be:

auto texture = std::make_shared<texture_t>();

Problem

I have the following class which I want to add to a `map` as a `shared_ptr`. ``` struct texture_t { hash32_t hash; uint32_t width; uint32_t height; uint32_t handle; }; ``` So I try and use `make_pair` and then add it to the `map`... ``` auto texture = std::make_shared<texture_t>(new texture_t()); std::make_pair<hash32_t, std::shared_ptr<texture_t>>(hash32_t(image->name), texture); ``` And on `make_pair`, I receive the following compile error: ``` error C2664: 'std::make_pair' : cannot convert parameter 2 from 'std::shared_ptr<_Ty>' to 'std::shared_ptr<_Ty> &&' ``` I feel like I'm missing something obvious, any clues?

Original source