C++11 无法将std::shared_ptr用作std::map中的值类型?

C++11 无法将std::shared_ptr用作std::map中的值类型?,c++11,map,shared-ptr,C++11,Map,Shared Ptr,我有下面的类,我想把它作为共享的name),std::make_shared())。 auto texture = std::make_shared<texture_t>();

我有下面的类,我想把它作为
共享的
添加到
映射中

struct texture_t
{
hash32_t hash;
uint32_t width;
uint32_t height;
uint32_t handle;
};
因此,我尝试使用
make_pair
,然后将其添加到
映射中

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);

我觉得我遗漏了一些明显的东西,有什么线索吗?

std::make\u pair
不用于显式模板参数。别管他们了:

auto my_pair = std::make_pair(hash32_t(image->name), texture);
注意:调用make_shared也是错误的。这些参数被传递给
纹理的构造函数,因此在这种情况下,它只是:

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

make_shared
的调用也是错误的。这已在中修复,但出于完整性考虑,这里可能值得一提。您只需使用
.emplace
将对插入到地图中,而无需手动构建它
map.emplace(hash32_t(image->name),std::make_shared())
auto texture = std::make_shared<texture_t>();