/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <array>
#include <iostream>
#include <vector>
std::array<int,4> someNums()
{
return {3, 5, 7, 11};
}
template<typename U, std::size_t size>
class Woop
{
public:
template<typename ...T>
constexpr Woop(T&&... nums) : numbers{nums...} {};
template<typename T, std::size_t arr_size>
constexpr Woop(std::array<T, arr_size>&& arr_nums) : numbers(arr_nums) {};
void report()
const {
for (auto&& i : numbers)
std::cout << i << ' ';
std::cout << '\n';
}
private:
const std::array<U, size> numbers;
//constexpr vector with C++20
};
int main()
{
Woop<int, 4> wooping1(someNums());
Woop<int, 7> wooping2{1, 2, 3, 5, 12 ,3 ,51};
wooping1.report();
wooping2.report();
return 0;
}