diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2019-08-28 15:12:51 -0700 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2019-10-16 08:56:57 -0700 |
commit | e65e61c812df90a56e3ce4a8e76c4b746766f387 (patch) | |
tree | 787fa4b641ed0d640f96cf430092961e9d7b1b20 /src/txdb.cpp | |
parent | c34b88620dc8435b83e6744895f2ecd3c9ec8de7 (diff) | |
download | bitcoin-e65e61c812df90a56e3ce4a8e76c4b746766f387.tar.xz |
Add some general std::vector utility functions
Added are:
* Vector(arg1,arg2,arg3,...) constructs a vector with the specified
arguments as elements. The vector's type is derived from the
arguments. If some of the arguments are rvalue references, they
will be moved into place rather than copied (which can't be achieved
using list initialization).
* Cat(vector1,vector2) returns a concatenation of the two vectors,
efficiently moving elements when relevant.
Vector generalizes (and replaces) the Singleton function in
src/descriptor.cpp, and Cat replaces the Cat function in bech32.cpp
Diffstat (limited to 'src/txdb.cpp')
-rw-r--r-- | src/txdb.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/txdb.cpp b/src/txdb.cpp index 536bfee901..a7eb5f9f67 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -12,6 +12,7 @@ #include <uint256.h> #include <util/system.h> #include <util/translation.h> +#include <util/vector.h> #include <stdint.h> @@ -102,7 +103,7 @@ bool CCoinsViewDB::BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock) { // A vector is used for future extensibility, as we may want to support // interrupting after partial writes from multiple independent reorgs. batch.Erase(DB_BEST_BLOCK); - batch.Write(DB_HEAD_BLOCKS, std::vector<uint256>{hashBlock, old_tip}); + batch.Write(DB_HEAD_BLOCKS, Vector(hashBlock, old_tip)); for (CCoinsMap::iterator it = mapCoins.begin(); it != mapCoins.end();) { if (it->second.flags & CCoinsCacheEntry::DIRTY) { |