/***************************************** * 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 SINGLE_LIST_H #define SINGLE_LIST_H #ifndef nullptr #define nullptr 0 #endif #include "ece250.h" #include "Single_node.h" #include "Exception.h" #include template class Single_list { private: Single_node *list_head; Single_node *list_tail; int list_size; public: Single_list(); Single_list( Single_list const & ); ~Single_list(); // Accessors int size() const; bool empty() const; Type front() const; Type back() const; Single_node *head() const; Single_node *tail() const; int count( Type const & ) const; // Mutators void swap( Single_list & ); Single_list &operator=( Single_list const & ); void push_front( Type const & ); void push_back( Type const & ); Type pop_front(); int erase( Type const & ); // Friends template friend std::ostream &operator<<( std::ostream &, Single_list const & ); }; template Single_list::Single_list(): list_head( nullptr ), list_tail( nullptr ), list_size( 0 ) { // empty constructor } template Single_list::Single_list( Single_list const &list ): list_head( nullptr ), list_tail( nullptr ), list_size( 0 ) { // enter your implementation here } template Single_list::~Single_list() { // enter your implementation here } template int Single_list::size() const { // enter your implementation here return 0; } template bool Single_list::empty() const { // enter your implementation here return true; } template Type Single_list::front() const { // enter your implementation here return Type(); } template Type Single_list::back() const { // enter your implementation here return Type(); } template Single_node *Single_list::head() const { // enter your implementation here return nullptr; } template Single_node *Single_list::tail() const { // enter your implementation here return nullptr; } template int Single_list::count( Type const &obj ) const { // enter your implementation here return 0; } template void Single_list::swap( Single_list &list ) { std::swap( list_head, list.list_head ); std::swap( list_tail, list.list_tail ); std::swap( list_size, list.list_size ); } template Single_list &Single_list::operator=( Single_list const &rhs ) { Single_list copy( rhs ); swap( copy ); return *this; } template void Single_list::push_front( Type const &obj ) { // enter your implementation here } template void Single_list::push_back( Type const &obj ) { // enter your implementation here } template Type Single_list::pop_front() { // enter your implementation here return Type(); } template int Single_list::erase( Type const &obj ) { // enter your implementation here return 0; } // You can modify this function however you want: it will not be tested template std::ostream &operator<<( std::ostream &out, Single_list const &list ) { for ( Single_node *ptr = list.head(); ptr != nullptr; ptr = ptr->next() ) { out << "->" << ptr->retrieve(); } out << "->0"; return out; } // Is an error showing up in ece250.h or elsewhere? // Did you forget a closing '}' ? #endif