From 2dce1916c55fa2da6a618ba6961d9ba1a0213929 Mon Sep 17 00:00:00 2001 From: Martin Schultz Date: Fri, 11 Sep 2015 15:41:16 +0200 Subject: [PATCH] * made STLReader reuse stringstreams --- src/OpenMesh/Core/IO/reader/STLReader.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/OpenMesh/Core/IO/reader/STLReader.cc b/src/OpenMesh/Core/IO/reader/STLReader.cc index d274844f..c75c81f2 100644 --- a/src/OpenMesh/Core/IO/reader/STLReader.cc +++ b/src/OpenMesh/Core/IO/reader/STLReader.cc @@ -249,6 +249,9 @@ read_stla(std::istream& _in, BaseImporter& _bi, Options& _opt) const std::string line; + static std::string garbage; + static std::stringstream strstream; + bool facet_normal(false); while( _in && !_in.eof() ) { @@ -265,9 +268,8 @@ read_stla(std::istream& _in, BaseImporter& _bi, Options& _opt) const // Normal found? if (line.find("facet normal") != std::string::npos) { - std::stringstream strstream(line); - - std::string garbage; + strstream.str(line); + strstream.clear(); // facet strstream >> garbage; @@ -292,9 +294,9 @@ read_stla(std::istream& _in, BaseImporter& _bi, Options& _opt) const std::getline(_in, line); trimStdString(line); - std::stringstream strstream(line); + strstream.str(line); + strstream.clear(); - std::string garbage; strstream >> garbage; strstream >> v[0];