fork download
  1. #include <vector>
  2.  
  3. template < typename T >
  4. void modify( T & t ) { }
  5.  
  6. int main() {
  7.  
  8. using namespace std;
  9.  
  10. vector<int> values; // construct once
  11.  
  12. while( ... ) {
  13. // we have a new named variable 'v' but don't need construct
  14. // vector<int> again, it share same memory with 'values'
  15. vector<int> & v = values;
  16. modify( values );
  17. }
  18. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty