I am confused about std::unique_ptr and std::make_unique as far as exception is concerned.
I believe unique_ptr is noexcept but make_unique can actually throw an std::bad_alloc.
In case I have this on the .hpp file:
std::unique_ptr<MATRIX[]> matrix;
And I will call this on the .cpp file:
std::make_unique<MATRIX[]>(256);
- Is there a chance that allocation will actuall fail?
- Should I add a handling in case allocation fails?
- How should the code look like then if I will add an exception handling?
Thanks!