fork download
  1. #include <vector>
  2. #include <string>
  3.  
  4. struct struct_type {
  5. int x;
  6. std::string s;
  7.  
  8. struct_type( int a_x, const std::string & a_s ) : x( a_x ), s( a_s )
  9. {
  10. }
  11. };
  12.  
  13. int main() {
  14. std::vector< struct_type > mass;
  15. mass = { { 1, "hello" }, { 42, "world" } };
  16. mass.push_back( { 3, "bla" } );
  17. mass.emplace( mass.end(), 3, "bla" );
  18. return 0;
  19. }
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
Standard output is empty