以下指针集之间有什么区别?什么时候在生产代码中使用每个指针,如果有的话?
例子将不胜感激!
scoped_ptr
shared_ptr
weak_ptr
intrusive_ptr
你在生产代码中使用boost吗?
在C++ 11中,如果我们尝试使用全局运算符new来分配负大小的数组,它将抛出std :: bad_array_new_length,但是C++ 98/C++ 03呢?它是UB还是会抛出std :: bad_alloc?
int main()
{
int* ptr = new int[-1];
}
Run Code Online (Sandbox Code Playgroud)