diff options
author | fanquake <fanquake@gmail.com> | 2021-03-22 11:22:06 +0800 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2021-03-22 11:22:06 +0800 |
commit | 5294f0d5a94cc7beaf692131fba0cad8beec9f13 (patch) | |
tree | ab68899a7525ad0a6747aaba04762dc98c73e032 /src/txmempool.cpp | |
parent | d2a78ee9288e4d3bace9125bcfae6b7747f85982 (diff) |
refactor: return std::nullopt instead of {}
In #21415 we decided to return `std::optional` rather than `{}` for
uninitialized values. This PR repalces the two remaining usages of `{}`
with `std::nullopt`.
As a side-effect, this also quells the spurious GCC 10.2.x warning that
we've had reported quite a few times. i.e #21318, #21248, #20797.
```bash
txmempool.cpp: In member function ‘CTxMemPool::setEntries CTxMemPool::GetIterSet(const std::set<uint256>&) const’:
txmempool.cpp:898:13: warning: ‘<anonymous>’ may be used uninitialized in this function [-Wmaybe-uninitialized]
898 | return {};
| ^
```
Diffstat (limited to 'src/txmempool.cpp')
-rw-r--r-- | src/txmempool.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp index faccd1ade0..67549fc13d 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -895,7 +895,7 @@ std::optional<CTxMemPool::txiter> CTxMemPool::GetIter(const uint256& txid) const { auto it = mapTx.find(txid); if (it != mapTx.end()) return it; - return {}; + return std::nullopt; } CTxMemPool::setEntries CTxMemPool::GetIterSet(const std::set<uint256>& hashes) const |