#include #include #include using namespace std; // templates not required by assignment template ostream& operator<<(ostream& os, vector const& v) { if ( v.size() == 0 ) return os << "[ ]"; typename vector::const_iterator it{ v.cbegin() }; os << "[ " << setw(4) << *it++; for ( ; it != v.cend(); ++it ) os << ' ' << setw(4) << *it; return os << " ]"; } // templates not required by assignment template istream& operator>>(istream& is, vector& v) { is >> ws; if ( is.peek() != '[' ) return is; is.ignore(); T i; is >> ws; while ( is.peek() != ']' ) { if ( is >> i >> ws ) v.emplace_back(i); } return is.ignore(); } // NO MODIFICATIONS BELOW THIS LINE void print(vector const& v) { cout << v << endl; } int main() { vector vi; string remain; cout << "Enter a vector of integers: " << endl; cin >> vi; cout << vi << endl; getline(cin, remain); cout << "remain in buffer: '" << remain << "'" << endl; return 0; }