HomePhabricator

[Backport]Add some general std::vector utility functions

Description

[Backport]Add some general std::vector utility functions

Summary:
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

Add tests for util/vector.h's Cat and Vector

Backport of Bitcoin Core PR16889

Test Plan: ninja && ninja check

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, majcosta, deadalnix

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, majcosta, deadalnix

Subscribers: majcosta

Differential Revision: https://reviews.bitcoinabc.org/D7502

Details

Provenance
Pieter Wuille <pieter.wuille@gmail.com>Authored on Aug 28 2019, 22:12
PiRKCommitted on Sep 22 2020, 14:15
PiRKPushed on Sep 22 2020, 14:16
Reviewer
Restricted Owners Package
Differential Revision
D7502: [Backport]Add some general std::vector utility functions
Parents
rABC9119eef6b046: Decouple updating seeds from automated commits pipeline
Branches
Unknown
Tags
Unknown