fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. vector<pair<int, string>> v = {{1, "oops"}}; // 1 element inside
  8. int main() {
  9. auto& e = v[0];
  10. v.emplace_back(e.first, e.second);
  11.  
  12. return 0;
  13. }
Success #stdin #stdout 0s 16056KB
stdin
Standard input is empty
stdout
Standard output is empty