fork download
  1. #include <vector>
  2. #include <cassert>
  3. using namespace std;
  4.  
  5. struct T {} t;
  6.  
  7. int main ()
  8. {
  9. vector <T> v1 = {42};
  10. assert (v1.size () == 42);
  11. vector <T> v2 = {42, t};
  12. assert (v2.size () == 42);
  13. return 0;
  14. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:9:24: error: converting to ‘std::vector<T>’ from initializer list would use explicit constructor ‘std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type) [with _Tp = T; _Alloc = std::allocator<T>; std::vector<_Tp, _Alloc>::size_type = unsigned int]’
stdout
Standard output is empty