fork(2) download
  1. #include <array>
  2. #include <utility>
  3. #include <algorithm>
  4. #include <iostream>
  5.  
  6. template<class T, class... Tail>
  7. std::array<T,1+sizeof...(Tail)> make_array(T&& head, Tail&&... values)
  8. {
  9. return std::array<T,1+sizeof...(Tail)>{
  10. std::forward<T>(head), std::forward<Tail>(values)... };
  11. }
  12.  
  13. int main(){
  14. auto arr = make_array(1,3,3,7,0,4,2,0,3,1,4,1,5,9);
  15. std::for_each(arr.begin(), arr.end(), [](int& val){std::cout << val << " ";});
  16. }
Success #stdin #stdout 0s 2828KB
stdin
Standard input is empty
stdout
1 3 3 7 0 4 2 0 3 1 4 1 5 9