// ----------------------------------------------------------------------------- // FlexArray class implementation flex.cpp // A. Fischer and M. Fischer, September 2010 // Revised September 2018 // ----------------------------------------------------------------------------- // Function definitions for arrays that can grow. // The base type of the array is controlled by a typedef. #include "flex.hpp" //------------------------------------------------------------------------------ // Pre: There is a newly allocated but uninitialized FlexArray. // Post: The flexarray is internally consistent, empty, and ready to use. // Flex::Flex( int initial ) : max(initial), ar(new ET[max]) { cout <<">>> New FlexArray, size = " <>> Deleted FlexArray, size = " <0. // Post: The length of FlexArray has been doubled. // Error: System thows an exception in case of an allocation error. // void Flex::grow() { ET* temp = ar; ar = new Item[ max*=2 ]; for (int k=0; k>> Grew FlexArray, size now = " <