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>
22 std::vector<
typename std::common_type<Args...>::type> ret;
23 ret.reserve(
sizeof...(args));
26 (void)std::initializer_list<int>{
27 (ret.emplace_back(std::forward<Args>(args)), 0)...};
32 template <
typename V>
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));
41 template <
typename V>
inline V
Cat(V v1,
const V &v2) {
42 v1.reserve(v1.size() + v2.size());
43 for (
const auto &arg : v2) {
49 #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.