有没有人曾经使用过C++的"贴牌新品"?如果是这样,那该怎么办?在我看来,它只对内存映射硬件有用.
我发现这个代码示例用于研究:
T & T::operator=(T const & x)
{
if (this != &x)
{
this->~T(); // destroy in place
new (this) T(x); // construct in place
}
return *this;
}
Run Code Online (Sandbox Code Playgroud)
当我查看文档时,new没有带指针的版本.从而: