Optimize parameter passing to avoid unnecessary copying

This commit is contained in:
Pugemon
2024-06-07 04:00:38 +03:00
parent 46ca1bb04a
commit f25a425cb9
123 changed files with 578 additions and 522 deletions
+5 -3
View File
@@ -1,5 +1,7 @@
#include "CheckBox.hpp"
#include <utility>
#include "../../core/DrawContext.hpp"
#include "../../core/Batch2D.hpp"
#include "Label.hpp"
@@ -30,11 +32,11 @@ void CheckBox::mouseRelease(GUI*, int, int) {
}
void CheckBox::setSupplier(boolsupplier supplier) {
this->supplier = supplier;
this->supplier = std::move(supplier);
}
void CheckBox::setConsumer(boolconsumer consumer) {
this->consumer = consumer;
this->consumer = std::move(consumer);
}
CheckBox* CheckBox::setChecked(bool flag) {
@@ -42,7 +44,7 @@ CheckBox* CheckBox::setChecked(bool flag) {
return this;
}
FullCheckBox::FullCheckBox(std::wstring text, glm::vec2 size, bool checked)
FullCheckBox::FullCheckBox(const std::wstring& text, glm::vec2 size, bool checked)
: Panel(size),
checkbox(std::make_shared<CheckBox>(checked)){
setColor(glm::vec4(0.0f));