5 #ifndef BITCOIN_UTIL_VECTOR_H 6 #define BITCOIN_UTIL_VECTOR_H 8 #include <initializer_list> 19 template<
typename... Args>
20 inline std::vector<
typename std::common_type<Args...>::type>
Vector(Args&&... args)
22 std::vector<
typename std::common_type<Args...>::type> ret;
23 ret.reserve(
sizeof...(args));
25 (void)std::initializer_list<int>{(ret.emplace_back(std::forward<Args>(args)), 0)...};
31 inline V
Cat(V v1, V&& v2)
33 v1.reserve(v1.size() + v2.size());
34 for (
auto& arg : v2) {
35 v1.push_back(std::move(arg));
42 inline V
Cat(V v1,
const V& v2)
44 v1.reserve(v1.size() + v2.size());
45 for (
const auto& arg : v2) {
51 #endif // BITCOIN_UTIL_VECTOR_H std::vector< typename std::common_type< Args... >::type > Vector(Args &&... args)
Construct a vector with the specified elements.
V Cat(V v1, V &&v2)
Concatenate two vectors, moving elements.