mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-19 20:25:18 +01:00
Merge #14287: tests: Use MakeUnique to construct objects owned by unique_ptrs
b6718e373e tests: Use MakeUnique to construct objects owned by unique_ptrs (practicalswift)
Pull request description:
A subset of #14211 ("Use MakeUnique to construct objects owned by unique_ptrs") as suggested by @MarcoFalke in https://github.com/bitcoin/bitcoin/pull/14211#issuecomment-423324019.
Use `MakeUnique` to construct objects owned by `unique_ptr`s.
Rationale:
* `MakeUnique` ensures exception safety in complex expressions.
* `MakeUnique` gives a more concise statement of the construction.
Tree-SHA512: 1228ae6ce7beb178d79142c4e936b728178ccaa8aa35c6d8feeb33d1a667abfdd010c59996a9d833594611e913877ce5794e75953d11d9b1fdbac04aa491d9cf
This commit is contained in:
@@ -439,6 +439,11 @@ General C++
|
||||
|
||||
- *Rationale*: This avoids memory and resource leaks, and ensures exception safety
|
||||
|
||||
- Use `MakeUnique()` to construct objects owned by `unique_ptr`s
|
||||
|
||||
- *Rationale*: `MakeUnique` is concise and ensures exception safety in complex expressions.
|
||||
`MakeUnique` is a temporary project local implementation of `std::make_unique` (C++14).
|
||||
|
||||
C++ data structures
|
||||
--------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user