From c0e68b96f7b4565e6e35e021df9d59cb84e04735 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Wed, 24 Apr 2024 18:10:43 +0200 Subject: [PATCH] table: emplace (back) function --- src/entt/entity/table.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/entt/entity/table.hpp b/src/entt/entity/table.hpp index bb8b2f9e4..a9bf3ef73 100644 --- a/src/entt/entity/table.hpp +++ b/src/entt/entity/table.hpp @@ -356,6 +356,17 @@ public: return {std::get>(payload).rend()...}; } + /** + * @brief Appends a row to the end of a table. + * @tparam Args Types of arguments to use to construct the row data. + * @param args Parameters to use to construct the row data. + * @return A reference to the newly created row data. + */ + template + std::tuple emplace(Args &&...args) { + return std::forward_as_tuple(std::get>(payload).emplace_back(std::forward(args))...); + } + /** * @brief Returns the row data at specified location. * @param pos The row for which to return the data.