fork(1) download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. template<class T>
  6. void TestVec(std::vector<T>& v, T val)
  7. {
  8. v.push_back(val);
  9. }
  10.  
  11.  
  12. int main() {
  13. std::vector<int> int_vec;
  14. std::vector<std::string> str_vec;
  15. TestVec(int_vec, 228);
  16. TestVec(str_vec, std::string("pidor"));
  17.  
  18. std::cout<< int_vec.back() << " " << str_vec.back();
  19. // your code goes here
  20. return 0;
  21. }
Success #stdin #stdout 0s 4392KB
stdin
Standard input is empty
stdout
228 pidor