fork download
  1. #include <iostream>
  2. #include <array>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. //template <typename T, std::size_t N>
  8. void arr_on_fly(std::array<int, 4> vec)
  9. {
  10. /*...*/
  11. }
  12.  
  13. //template <typename T1, typename T2>
  14. void vec_on_fly(const std::vector<int> &vec)
  15. {
  16. /*...*/
  17. }
  18.  
  19. int main()
  20. {
  21. vec_on_fly({1,2, 3, 4});
  22. arr_on_fly({1,2,3,4});
  23. }
  24.  
  25.  
  26. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:22:21: error: could not convert '{1, 2, 3, 4}' to 'std::array<int, 4u>'
prog.cpp: At global scope:
prog.cpp:26:1: error: expected declaration before '}' token
stdout
Standard output is empty