diff --git a/src/Project-Orion/serialization.cpp b/src/Project-Orion/serialization.cpp index 2758fa7..6a493f1 100644 --- a/src/Project-Orion/serialization.cpp +++ b/src/Project-Orion/serialization.cpp @@ -5,7 +5,7 @@ #include #include -UserList&& loadUserList(const QString &file) +UserList loadUserList(const QString &file) { QFile doc{std::filesystem::path{file.toStdString()}}; QString fileContents = doc.readAll(); @@ -23,10 +23,7 @@ UserList&& loadUserList(const QString &file) container.append(newUser); } - UserList returnObj; - returnObj.setList(container); - - return std::move(returnObj); + return container; } void saveUserList(const UserList &list) diff --git a/src/Project-Orion/serialization.h b/src/Project-Orion/serialization.h index e8bba2c..674e88f 100644 --- a/src/Project-Orion/serialization.h +++ b/src/Project-Orion/serialization.h @@ -3,7 +3,7 @@ #include "userlist.h" -UserList &&loadUserList(const QString &file); +UserList loadUserList(const QString &file); void saveUserList(const UserList &list); #endif // SERIALIZATION_H diff --git a/src/Project-Orion/userlist.cpp b/src/Project-Orion/userlist.cpp index a063fc7..0ea10d8 100644 --- a/src/Project-Orion/userlist.cpp +++ b/src/Project-Orion/userlist.cpp @@ -1,6 +1,8 @@ #include "userlist.h" -UserList::UserList() {} +UserList::UserList(const QVector &list): + list{list} +{} QVector UserList::getList() const { diff --git a/src/Project-Orion/userlist.h b/src/Project-Orion/userlist.h index 18d3f43..6b0c155 100644 --- a/src/Project-Orion/userlist.h +++ b/src/Project-Orion/userlist.h @@ -9,7 +9,7 @@ class UserList: public QObject { Q_OBJECT public: - UserList(); + UserList(const QVector &list); QVector getList() const; void setList(const QVector &newList);