Cleanup; consistent formatting.

This commit is contained in:
Anthony Calandra
2018-12-12 17:14:31 -05:00
parent dff069e9f5
commit b1b0d0e3cc
4 changed files with 142 additions and 136 deletions

View File

@@ -181,7 +181,7 @@ decltype(auto) a2t(const std::array<T, N>& a) {
* Prevents code repetition when specifying the underlying type the pointer shall hold.
* Most importantly, it provides exception-safety. Suppose we were calling a function `foo` like so:
```c++
foo(std::unique_ptr<T>{ new T{} }, function_that_throws(), std::unique_ptr<T>{ new T{} });
foo(std::unique_ptr<T>{new T{}}, function_that_throws(), std::unique_ptr<T>{new T{}});
```
The compiler is free to call `new T{}`, then `function_that_throws()`, and so on... Since we have allocated data on the heap in the first construction of a `T`, we have introduced a leak here. With `std::make_unique`, we are given exception-safety:
```c++