aboutsummaryrefslogtreecommitdiff
path: root/Homework7
diff options
context:
space:
mode:
Diffstat (limited to 'Homework7')
-rw-r--r--Homework7/Homework7/ContactList.cpp37
-rw-r--r--Homework7/Homework7/ContactList.h10
2 files changed, 47 insertions, 0 deletions
diff --git a/Homework7/Homework7/ContactList.cpp b/Homework7/Homework7/ContactList.cpp
index b934182..df6c849 100644
--- a/Homework7/Homework7/ContactList.cpp
+++ b/Homework7/Homework7/ContactList.cpp
@@ -1,4 +1,5 @@
#include "ContactList.h"
+#include <atomic>
@@ -67,3 +68,39 @@ Contact* ContactList::AllocateContactList(const size_t& size)
return contacts;
}
+
+
+ContactList::ContactList(const Contact& copy) {
+ *this = copy;
+}
+
+
+ContactList& ContactList::operator=(const ContactList& rhs) {
+ if (this != &rhs) {
+ contacts_ = rhs.contacts_;
+ length_ = rhs.length_;
+ size_ = rhs.size_;
+ rhs.contacts_ = nullptr;
+ rhs.length_ = 0;
+ rhs.size_ = 0;
+
+ }
+ return *this;
+}
+
+
+ContactList::ContactList(Contact&& move) {
+ *this = std::move(move);
+}
+
+ContactList& ContactList::operator=(ContactList&& rhs) {
+ if (this != &rhs) {
+ contacts_ = rhs.contacts_;
+ length_ = rhs.length_;
+ size_ = rhs.size_;
+ rhs.contacts_ = nullptr;
+ rhs.length_ = 0;
+ rhs.size_ = 0;
+ }
+ return *this;
+} \ No newline at end of file
diff --git a/Homework7/Homework7/ContactList.h b/Homework7/Homework7/ContactList.h
index cf0b711..e449bc9 100644
--- a/Homework7/Homework7/ContactList.h
+++ b/Homework7/Homework7/ContactList.h
@@ -5,6 +5,16 @@
class ContactList {
public:
+
+ ContactList(const Contact& copy);
+ ContactList& operator=(const ContactList& rhs);
+
+ ContactList& operator=(const Contact& rhs);
+
+
+ ContactList(Contact&& move);
+ ContactList& operator=(ContactList&& rhs);
+
ContactList() = default;
ContactList(const size_t& size);
~ContactList();