fork download
  1. #include <array>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. void pretty_print_r3(const array<float, 3> &xs) {
  6. for (float x : xs ) cout << x << endl;
  7. }
  8.  
  9. int main() {
  10. auto xs = array<float, 2>{1, 2};
  11. pretty_print_r3(xs);
  12. return 0;
  13. }
Compilation error #stdin compilation error #stdout 0s 3468KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:11:20: error: invalid initialization of reference of type 'const std::array<float, 3u>&' from expression of type 'std::array<float, 2u>'
  pretty_print_r3(xs);
                    ^
prog.cpp:5:6: note: in passing argument 1 of 'void pretty_print_r3(const std::array<float, 3u>&)'
 void pretty_print_r3(const array<float, 3> &xs) {
      ^
stdout
Standard output is empty