fork download
  1. // vector::emplace
  2. #include <iostream>
  3. #include <string>
  4. #include <vector>
  5. class test
  6. {
  7. public:
  8. int a,b;
  9. std::string c;
  10. test(int a,int b,std::string c)
  11. {
  12. this->a=a;
  13. this->b=b;
  14. this->c=c;
  15. }
  16. };
  17. int main ()
  18. {
  19. std::vector<test> v;
  20.  
  21. v.emplace ( v.begin(), 1, 2, "kek");
  22.  
  23. std::cout << v[0].c;
  24. return 0;
  25. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
kek