From 6657606e81114b47afa7cb297866e694eb41eb8b Mon Sep 17 00:00:00 2001
From: Patrick Wuttke
Date: Sat, 20 Sep 2025 14:26:18 +0200
Subject: [PATCH] Made data table header a const char* to avoid unnecessary
allocations.
---
public/raid/imraid.hpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/public/raid/imraid.hpp b/public/raid/imraid.hpp
index a59edb5..98981f1 100644
--- a/public/raid/imraid.hpp
+++ b/public/raid/imraid.hpp
@@ -73,7 +73,7 @@ struct DataTableColumn
using renderer_t = std::function;
using comparator_t = std::function;
- std::string header;
+ const char* header;
renderer_t renderer;
comparator_t comparator;
};
@@ -85,7 +85,7 @@ struct DataTableOptions
ImGuiTableFlags tableFlags = ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Sortable | ImGuiTableFlags_ScrollY;
};
-template
+template
inline void DataTable(const char* strId, const DataTableOptions& options, const TData& data, DataTableState& state, ImVec2 outerSize = {})
{
if (outerSize.y <= 0.f) {
@@ -103,7 +103,7 @@ inline void DataTable(const char* strId, const DataTableOptions& option
if (!column.comparator) {
flags |= ImGuiTableColumnFlags_NoSort;
}
- ImGui::TableSetupColumn(column.header.c_str(), flags);
+ ImGui::TableSetupColumn(column.header, flags);
}
ImGui::TableSetupScrollFreeze(0, 1);
ImGui::TableHeadersRow();