diff options
| author | Yana Blashchishina <[email protected]> | 2024-03-10 15:22:23 -0700 |
|---|---|---|
| committer | Yana Blashchishina <[email protected]> | 2024-03-10 15:22:23 -0700 |
| commit | cd4047c8c788500e0a93a83dbcd3edbad92a517b (patch) | |
| tree | 95367e5245edd1e87ac918e004538c96ed4edf95 /Homework 8 | |
| parent | defining functions (diff) | |
| download | homework-8-yanablash-cd4047c8c788500e0a93a83dbcd3edbad92a517b.tar.xz homework-8-yanablash-cd4047c8c788500e0a93a83dbcd3edbad92a517b.zip | |
voids
Diffstat (limited to 'Homework 8')
| -rw-r--r-- | Homework 8/MyStructures/ContactList.hpp | 64 |
1 files changed, 34 insertions, 30 deletions
diff --git a/Homework 8/MyStructures/ContactList.hpp b/Homework 8/MyStructures/ContactList.hpp index b8e981f..c8c299a 100644 --- a/Homework 8/MyStructures/ContactList.hpp +++ b/Homework 8/MyStructures/ContactList.hpp @@ -8,42 +8,46 @@ namespace MySStructures template<class C> class ContactList { + public: + /** + * Contains an array of Contacts or othe C class objects + */ ContactList() = default; - ContactList(size_t length); //Creates contact list of this size - ContactList(const C* contacts, const size_t& length); //Makes a copy of another contact list + ContactList(size_t length); //Creates contact list of this size + ContactList(const C* contacts, const size_t& length); //Makes a copy of another contact list ~ContactList(); - ContactList(const ContactList& copy); //deep copy constructor - ContactList& operator=(const ContactList& rhs); //deep copy assignment + ContactList(const ContactList& copy); //deep copy constructor + ContactList& operator=(const ContactList& rhs); //deep copy assignment - ContactList(ContactList&& move); //reference(move) constructor - ContactList& operator=(ContactList&& rhs); //reference(move) assignment - - void Print() const; //Print the Contact List, calling Print on each element. + ContactList(ContactList&& move); //reference(move) constructor + ContactList& operator=(ContactList&& rhs); //reference(move) assignment + + void Print() const; //Print the Contact List, calling Print on each element. size_t Size() const; //Return the size of the contact list - void Append(const C& data); //Add contact to back of list - void Prepend(const C& data); //add contact as first contact - void RemoveLast(); //removes last contact - void RemoveFirst(); //removes first contact - void Extract(const C& data); //delete this contact: data - void InsertAfter(const C& data, const C& after); //insert contact data after 'after' contact - void InsertBefore(const C& data, const C& before); //insert contact data before 'before' contact - void Clear(); //Deletes all contacts, empties the list, nothing left! - - C& Last(); //returns last contact reference in list - C Last() const; //returns copy of last contact in list - C& First(); //returns first contact reference in lsit - C First() cosnt; //returns first contact copy - - C& operator[](const int& index); - C operator[](const int& index) const; - explicit operator bool() const; - - bool operator==(const ContactList<C>& rhs) const; - bool Empty() const; - - + void Append(const C& data); //Add contact to back of list + void Prepend(const C& data); //add contact as first contact + void RemoveLast(); //removes last contact + void RemoveFirst(); //removes first contact + void Extract(const C& data); //delete this contact: data + void InsertAfter(const C& data, const C& after); //insert contact data after 'after' contact + void InsertBefore(const C& data, const C& before); //insert contact data before 'before' contact + void Clear(); //Deletes all contacts, empties the list, nothing left! + + C& Last(); //returns last contact reference in list + C Last() const; //returns copy of last contact in list + C& First(); //returns first contact reference in lsit + C First() cosnt; //returns first contact copy + + C& operator[](const int& index); //returns contact reference via [] overload + C operator[](const int& index) const; //returns contact copy via [] overload + explicit operator bool() const; // overloads ContactList to return to true/false as boolean operator + + bool operator==(const ContactList<C>& rhs) const; //if (newContact == old Contact) + bool Empty() const; //is the list empty + + |