fork download
  1. #include <initializer_list>
  2.  
  3. struct Vector
  4. {
  5. float v[3];
  6.  
  7. Vector(std::initializer_list<float> values) : v(values) {}
  8. };
  9.  
  10. int main()
  11. {
  12. Vector v = {1, 2, 3};
  13. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In constructor ‘Vector::Vector(std::initializer_list<float>)’:
prog.cpp:7:59: error: incompatible types in assignment of ‘std::initializer_list<float>’ to ‘float [3]’
stdout
Standard output is empty