【发布时间】:2013-08-25 21:06:29
【问题描述】:
我是智能指针的新手,我正在解决每一个绊脚石。
我有一个结构 texture_t:
struct texture_t
{
hash32_t hash;
uint32_t width;
uint32_t height;
uint32_t handle;
};
当我尝试使用此行创建此结构的 shared_ptr 时:
auto texture_shared_ptr = std::make_shared<texture_t>(new texture_t());
我收到此错误:
error C2664: 'mandala::texture_t::texture_t(const mandala::texture_t &)' : cannot convert parameter 1 from 'mandala::texture_t *' to 'const mandala::texture_t &'
这个错误来自哪里,我该如何避免它?
【问题讨论】:
标签: c++ shared-ptr make-shared