1 auto getter() { 2 return new vector<int>(); 3 } 4 auto setter(vector<int>* vec) { 5 int x; 6 while (cin >> x) 7 vec->push_back(x); 8 return vec; 9 } 10 auto read(vector<int>* vec) { 11 for (auto fuck : *vec) 12 cout << fuck << ends; 13 } 14 int main() { 15 16 auto vec=getter(); 17 vec=setter(vec); 18 read(vec); 19 delete vec; 20 }
16.4 template<typename I, typename T>I my_find(I b, I e, T val) { while (b != e) { if (*b == val)return b; else ++b; }return e; }
16.5 template<typename T, unsigned N>auto print(const T(&x)[N]) { for (auto s : x)cout << s << endl; }