相关疑难解决方法(0)

智能指针(boost)解释道

以下指针集之间有什么区别?什么时候在生产代码中使用每个指针,如果有的话?

例子将不胜感激!

  1. scoped_ptr

  2. shared_ptr

  3. weak_ptr

  4. intrusive_ptr

你在生产代码中使用boost吗?

c++ boost smart-pointers

218
推荐指数
4
解决办法
8万
查看次数

操作员新的负大小

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

c++

5
推荐指数
1
解决办法
2634
查看次数

标签 统计

c++ ×2

boost ×1

smart-pointers ×1