5#ifndef BITCOIN_UTIL_VECTOR_H
6#define BITCOIN_UTIL_VECTOR_H
9#include <initializer_list>
21template <
typename... Args>
22inline std::vector<
typename std::common_type<Args...>::type>
24 std::vector<
typename std::common_type<Args...>::type> ret;
25 ret.reserve(
sizeof...(args));
28 (void)std::initializer_list<int>{
29 (ret.emplace_back(std::forward<Args>(args)), 0)...};
34template <
typename V>
inline V
Cat(V v1, V &&v2) {
35 v1.reserve(v1.size() + v2.size());
36 for (
auto &arg : v2) {
37 v1.push_back(std::move(arg));
43template <
typename V>
inline V
Cat(V v1,
const V &v2) {
44 v1.reserve(v1.size() + v2.size());
45 for (
const auto &arg : v2) {
51template <
typename V,
typename L>
52inline std::optional<V>
FindFirst(
const std::vector<V> &vec,
const L fnc) {
53 for (
const auto &el : vec) {
V Cat(V v1, V &&v2)
Concatenate two vectors, moving elements.
std::optional< V > FindFirst(const std::vector< V > &vec, const L fnc)
std::vector< typename std::common_type< Args... >::type > Vector(Args &&...args)
Construct a vector with the specified elements.