Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我使用new并获取std::bad_alloc编译器,请不要因为异常而调用构造函数。但是它如何处理nothrow new我们在每种情况下都得到指针的原因呢?这种情况的标准中是否有特殊段落?
new
std::bad_alloc
nothrow new
[expr.new]/16 ... 如果分配函数返回null,则不进行初始化,不调用deallocation函数,new-expression的值为null。