#include #include #include template auto build_array(Args&&... args) -> std::array::type, sizeof...(args)> { using commonType = typename std::common_type::type; // Create array return {std::forward(args)...}; } int main() { auto data {build_array(1, 0u, 'a', 3.2f, false)}; for (const auto& i : data) std::cout << i << " "; std::cout << std::endl; return 0; }