From afc79d43f01de1f52f046dffebce603f3a358b1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 19 Sep 2022 21:46:00 +0200 Subject: [PATCH] sceneconverter: clean up some unnecessary std::string allocations. In one case I can even avoid a double lookup thanks to StringView having sane bool conversion by default. --- src/Magnum/SceneTools/sceneconverter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Magnum/SceneTools/sceneconverter.cpp b/src/Magnum/SceneTools/sceneconverter.cpp index 114a825f4..47cbee698 100644 --- a/src/Magnum/SceneTools/sceneconverter.cpp +++ b/src/Magnum/SceneTools/sceneconverter.cpp @@ -444,8 +444,8 @@ the first mesh.)") std::chrono::high_resolution_clock::duration conversionTime{}; /* Filter mesh attributes, if requested */ - if(!args.value("only-mesh-attributes").empty()) { - const Containers::Optional> only = Utility::String::parseNumberSequence(args.value("only-mesh-attributes"), 0, mesh->attributeCount()); + if(const Containers::StringView onlyMeshAttributes = args.value("only-mesh-attributes")) { + const Containers::Optional> only = Utility::String::parseNumberSequence(onlyMeshAttributes, 0, mesh->attributeCount()); if(!only) return 2; /** @todo use MeshTools::filterOnlyAttributes() once it has a rvalue @@ -476,7 +476,7 @@ the first mesh.)") /* Remove duplicate vertices with fuzzy comparison, if requested */ /** @todo accept two values for float and double fuzzy comparison */ - if(!args.value("remove-duplicate-vertices-fuzzy").empty()) { + if(args.value("remove-duplicate-vertices-fuzzy")) { const UnsignedInt beforeVertexCount = mesh->vertexCount(); { Trade::Implementation::Duration d{conversionTime};