/***************************************** * Instructions * - Replace 'uwuserid' with your uWaterloo User ID * - Select the current calendar term and enter the year * - List students with whom you had discussions and who helped you * * uWaterloo User ID: uwuserid @uwaterloo.ca * Submitted for ECE 250 * Department of Electrical and Computer Engineering * University of Waterloo * Calender Term of Submission: (Winter|Spring|Fall) 201N * * By submitting this file, I affirm that * I am the author of all modifications to * the provided code. * * The following is a list of uWaterloo User IDs of those students * I had discussions with in preparing this project: * - * * The following is a list of uWaterloo User IDs of those students * who helped me with this project (describe their help; e.g., debugging): * - *****************************************/ #ifndef DEQUE_H #define DEQUE_H #ifndef nullptr #define nullptr 0 #endif #include #include "Exception.h" template class Deque { private: int array_capacity; Type *array; int ihead; int itail; int entry_count; public: Deque( int = 10 ); Deque( Deque const & ); ~Deque(); Type head() const; Type tail() const; int size() const; bool empty() const; int capacity() const; void swap( Deque & ); Deque &operator=( Deque const & ); void enqueue_head( Type const & ); void enqueue_tail( Type const & ); Type dequeue_head(); Type dequeue_tail(); void clear(); // Friends template friend std::ostream &operator<<( std::ostream &, Deque const & ); }; template Deque::Deque( int n ): array_capacity( std::max( 1, n ) ), array( new Type[array_capacity] ), entry_count( 0 ) { // empty } template Deque::~Deque() { // Enter your implementation here. } template Deque::Deque( Deque const &deque ): array_capacity( deque.array_capacity ), array( new Type[array_capacity] ), ihead( deque.ihead ), itail( deque.itail ), entry_count( deque.entry_count ) { // The above initializations copy the values of the appropriate // member variables and allocate memory for the data structure; // however, you must still copy the stored objects. // Enter your implementation here. } template int Deque::size() const { // Enter your implementation here. return 0; } template int Deque::capacity() const { return array_capacity; } template bool Deque::empty() const { // Enter your implementation here. return true; } template Type Deque::head() const { // Enter your implementation here. return Type(); // This returns a default object } template Type Deque::tail() const { // Enter your implementation here. return Type(); // This returns a default object } template void Deque::swap( Deque &queue ) { std::swap( array_capacity, queue.array_capacity ); std::swap( array, queue.array ); std::swap( ihead, queue.ihead ); std::swap( itail, queue.itail ); std::swap( entry_count, queue.entry_count ); } template Deque &Deque::operator=( Deque const &rhs ) { Deque copy( rhs ); swap( copy ); return *this; } template void Deque::enqueue_head( Type const &obj ) { // Enter your implementation here. } template void Deque::enqueue_tail( Type const &obj ) { // Enter your implementation here. } template Type Deque::dequeue_head() { // Enter your implementation here. return Type(); // This returns a default object } template Type Deque::dequeue_tail() { // Enter your implementation here. return Type(); // This returns a default object } template void Deque::clear() { // Enter your implementation here. } // You can modify this function however you want: it will not be tested template std::ostream &operator<<( std::ostream &out, Deque const &deque ) { // Print out your stacks return out; } // Is an error showing up in ece250.h or elsewhere? // Did you forget a closing '}' ? #endif