// MT1Q4c.cpp - Array from std::vector #include #include // Question MT1Q4 asks for an array class, not an // STL container wrapper, but I'll give partial credit // for a solution that behaves like an array, e.g., // like the following: struct rowDisplayPolicy { static std::string seperator() { return ", "; } }; struct columnDisplayPolicy { static std::string seperator() { return "\n "; } }; template class Array { public: typename typedef std::vector::iterator iterator; // This Array doesn't need copy, assign, or destructor // since its vec member has correct operations, so // compiler will generate correct operations. Array() { for(size_t i=0; i vec; }; int main() { double dtemp[] = { 0.0, 0.5, 1.0, 1.5, 2.0, 2.5 }; Array arr1(dtemp); arr1.display(); Array arr2(dtemp); arr2.display(); std::cout << "\n"; }