4 ms·
> You can use new without exceptions, but you can't detect OOM then, if I'm not mistaken. AFAIK `new (std::nothrow) T` returns nullptr if allocation fails, lik
by qalmakka 6y ago
> You can use new without exceptions, but you can't detect OOM then, if I'm not mistaken.
AFAIK `new (std::nothrow) T` returns nullptr if allocation fails, like std::malloc.
- spacechild1 6y agoExactly! It's worth pointing out that 'new (std::nowthrow) T' itself also performs a NULL check, so it doesn't call the constructor if the allocation failed.