We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
template smart_ptr::smart_ptr(const smart_ptr& rhs) :m_pobject(rhs.m_pobject), m_p_use_count(rhs.m_p_use_count), m_del(rhs.m_del) { (*m_p_use_count)++; } 如果调用这个函数,例如:smart_ptr ptr2(ptr1); 只有ptr2的引用计数会加1,ptr1的引用计数没变,我觉得有问题,应该ptr1和ptr2使用一块memory作为引用计数,确保ptr2在增加引用计数时ptr1的引用计数也会变。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
template
smart_ptr::smart_ptr(const smart_ptr& rhs)
:m_pobject(rhs.m_pobject), m_p_use_count(rhs.m_p_use_count), m_del(rhs.m_del)
{
(*m_p_use_count)++;
}
如果调用这个函数,例如:smart_ptr ptr2(ptr1);
只有ptr2的引用计数会加1,ptr1的引用计数没变,我觉得有问题,应该ptr1和ptr2使用一块memory作为引用计数,确保ptr2在增加引用计数时ptr1的引用计数也会变。
The text was updated successfully, but these errors were encountered: