5#ifndef BITCOIN_UTIL_VECTOR_H
6#define BITCOIN_UTIL_VECTOR_H
9#include <initializer_list>
22template<
typename... Args>
23inline std::vector<
typename std::common_type<Args...>::type>
Vector(Args&&...
args)
25 std::vector<
typename std::common_type<Args...>::type>
ret;
28 (void)std::initializer_list<int>{(
ret.emplace_back(std::forward<Args>(
args)), 0)...};
34inline V
Cat(V v1, V&& v2)
36 v1.reserve(v1.size() + v2.size());
37 for (
auto& arg : v2) {
38 v1.push_back(std::move(arg));
45inline V
Cat(V v1,
const V& v2)
47 v1.reserve(v1.size() + v2.size());
48 for (
const auto& arg : v2) {
72template<
typename V,
typename L>
73inline std::optional<V>
FindFirst(
const std::vector<V>& vec,
const L fnc)
75 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.
void ClearShrink(V &v) noexcept
Clear a vector (or std::deque) and release its allocated memory.