From cb7927a6fc1837b9366e34a3e2757220c0621523 Mon Sep 17 00:00:00 2001 From: Jorens Shtekels Date: Tue, 12 Mar 2024 22:41:47 +0200 Subject: [PATCH] feat: removed push initialization of vectors --- src/prep/prep.cpp | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/prep/prep.cpp b/src/prep/prep.cpp index 52253dc..c389448 100644 --- a/src/prep/prep.cpp +++ b/src/prep/prep.cpp @@ -18,16 +18,10 @@ bool Action::operator==(const Action &other) const { return this->name == other.name; } -Role::Role(std::initializer_list actions) { - for (auto &a : actions) { - this->actions.push_back(a); - } +Role::Role(std::initializer_list actions): Role(std::vector(actions)) { } -Role::Role(std::vector actions) { - for (auto &a : actions) { - this->actions.push_back(a); - } +Role::Role(std::vector actions): actions(actions) { } Player::Player(uint32_t id, std::string username, Role role, PlayerStatus playerStatus): @@ -68,14 +62,10 @@ Event::Event(std::string title, title(title), utcTimestampCreatedAt(createUTCTimestamp(utcTimestampCreatedAt)), numberNight(numberNight), - isVisible(isVisible) { + isVisible(isVisible), + prohibits(prohibits), + allows(allows) { this->utcTimestampCreatedAt = createUTCTimestamp(utcTimestampCreatedAt); - for (auto &a : prohibits) { - this->prohibits.push_back(a); - } - for (auto &a : allows) { - this->allows.push_back(a); - } } Event::Event(std::string title,