From 7410e31230d212d2b8be9df6ff8271472079b7c1 Mon Sep 17 00:00:00 2001 From: Anonymous275 <36374260+Anonymous-275@users.noreply.github.com> Date: Sat, 6 Mar 2021 01:45:20 +0200 Subject: [PATCH] Use of std::move and added DEBUG ifdef --- include/VehicleData.h | 2 +- src/VehicleData.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/VehicleData.h b/include/VehicleData.h index 3c693c0..f26392b 100644 --- a/include/VehicleData.h +++ b/include/VehicleData.h @@ -4,7 +4,7 @@ class TVehicleData final { public: - TVehicleData(int ID, const std::string& Data); + TVehicleData(int ID, std::string Data); ~TVehicleData(); [[nodiscard]] bool IsInvalid() const { return mID == -1; } diff --git a/src/VehicleData.cpp b/src/VehicleData.cpp index e3fbe5a..dd56d1e 100644 --- a/src/VehicleData.cpp +++ b/src/VehicleData.cpp @@ -1,12 +1,18 @@ #include "VehicleData.h" + +#include #include "Common.h" -TVehicleData::TVehicleData(int ID, const std::string& Data) +TVehicleData::TVehicleData(int ID, std::string Data) : mID(ID) - , mData(Data) { + , mData(std::move(Data)) { +#ifdef DEBUG debug("vehicle " + std::to_string(mID) + " constructed"); +#endif } TVehicleData::~TVehicleData() { +#ifdef DEBUG debug("vehicle " + std::to_string(mID) + " destroyed"); +#endif }