From 6066ca30b27b5ca25fe5d59f315ecd137d5c52f5 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 19 Jun 2018 13:36:52 -0400 Subject: [PATCH] DolphinQt2/RegisterWidget: std::move std::function instances in AddRegister() These can be moved into the RegisterColumn constructor, which avoids potential allocations in the case a std::function would otherwise need to allocate to hold all of it's captured data. Also tidy up the inclusion order while we're at it. --- Source/Core/DolphinQt2/Debugger/RegisterWidget.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Source/Core/DolphinQt2/Debugger/RegisterWidget.cpp b/Source/Core/DolphinQt2/Debugger/RegisterWidget.cpp index 2a2fff7aa2..2c063c4821 100644 --- a/Source/Core/DolphinQt2/Debugger/RegisterWidget.cpp +++ b/Source/Core/DolphinQt2/Debugger/RegisterWidget.cpp @@ -4,6 +4,13 @@ #include "DolphinQt2/Debugger/RegisterWidget.h" +#include + +#include +#include +#include +#include + #include "Core/Core.h" #include "Core/HW/ProcessorInterface.h" #include "Core/PowerPC/PowerPC.h" @@ -11,11 +18,6 @@ #include "DolphinQt2/QtUtils/ActionHelper.h" #include "DolphinQt2/Settings.h" -#include -#include -#include -#include - RegisterWidget::RegisterWidget(QWidget* parent) : QDockWidget(parent) { setWindowTitle(tr("Registers")); @@ -335,7 +337,7 @@ void RegisterWidget::PopulateTable() void RegisterWidget::AddRegister(int row, int column, RegisterType type, std::string register_name, std::function get_reg, std::function set_reg) { - auto* value = new RegisterColumn(type, get_reg, set_reg); + auto* value = new RegisterColumn(type, std::move(get_reg), std::move(set_reg)); if (m_table->rowCount() <= row) m_table->setRowCount(row + 1);