From 0d6a7165b90e65bf23287d3de4daa5743a75f9f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 4 May 2025 14:14:21 +0200 Subject: [PATCH] ObjImporter: don't use a std::vector. And yep, in-place initialization "just works" with Containers::Array, no idea what was wrong with std::vector::emplace_back(). --- src/MagnumPlugins/ObjImporter/ObjImporter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/MagnumPlugins/ObjImporter/ObjImporter.cpp b/src/MagnumPlugins/ObjImporter/ObjImporter.cpp index fee8d73e4..9084cf5e4 100644 --- a/src/MagnumPlugins/ObjImporter/ObjImporter.cpp +++ b/src/MagnumPlugins/ObjImporter/ObjImporter.cpp @@ -61,7 +61,7 @@ struct Mesh { struct ObjImporter::File { std::unordered_map meshesForName; - std::vector meshes; + Containers::Array meshes; Containers::Pointer in; }; @@ -138,7 +138,7 @@ void ObjImporter::parseMeshNames() { /* The first mesh doesn't have name by default but we might find it later, so we need to track whether there are any data before first name */ bool thisIsFirstMeshAndItHasNoData = true; - _file->meshes.emplace_back(Mesh{0, 0, positionIndexOffset, normalIndexOffset, textureCoordinateIndexOffset, std::string{}}); + arrayAppend(_file->meshes, InPlaceInit, 0, 0, positionIndexOffset, normalIndexOffset, textureCoordinateIndexOffset, std::string{}); while(_file->in->good()) { /* The previous object might end at the beginning of this line */ @@ -181,7 +181,7 @@ void ObjImporter::parseMeshNames() { updated later. */ if(!name.empty()) _file->meshesForName.emplace(name, _file->meshes.size()); - _file->meshes.emplace_back(Mesh{_file->in->tellg(), 0, positionIndexOffset, textureCoordinateIndexOffset, normalIndexOffset, Utility::move(name)}); + arrayAppend(_file->meshes, InPlaceInit, _file->in->tellg(), 0, positionIndexOffset, textureCoordinateIndexOffset, normalIndexOffset, Utility::move(name)); } continue;