diff --git a/libdevcore/CommonData.h b/libdevcore/CommonData.h index 801392107..d85f6ad3a 100644 --- a/libdevcore/CommonData.h +++ b/libdevcore/CommonData.h @@ -346,4 +346,27 @@ inline std::string findAnyOf(std::string const& _haystack, std::vector +void variadicEmplaceBack(std::vector&) {} +template +void variadicEmplaceBack(std::vector& _vector, A&& _a, Args&&... _args) +{ + _vector.emplace_back(std::forward(_a)); + variadicEmplaceBack(_vector, std::forward(_args)...); +} +} + +template +std::vector make_vector(Args&&... _args) +{ + std::vector result; + result.reserve(sizeof...(_args)); + detail::variadicEmplaceBack(result, std::forward(_args)...); + return result; +} + }