From: Bertrand <bco...@us...> - 2017-02-25 15:47:06
|
Update of /cvsroot/jsbsim/JSBSim/src/simgear/misc In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv31144/src/simgear/misc Modified Files: strutils.cxx Log Message: Removed the C++11 statements and C++98 instead since JBSim does not set the C++11 flag for compilation. Index: strutils.cxx =================================================================== RCS file: /cvsroot/jsbsim/JSBSim/src/simgear/misc/strutils.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** strutils.cxx 25 Feb 2017 14:23:20 -0000 1.1 --- strutils.cxx 25 Feb 2017 15:47:03 -0000 1.2 *************** *** 179,183 **** string_list split_on_any_of(const std::string& str, const char* seperators) { ! if (seperators == nullptr || (strlen(seperators) == 0)) { throw "illegal/missing seperator string"; } --- 179,183 ---- string_list split_on_any_of(const std::string& str, const char* seperators) { ! if (seperators == NULL || (strlen(seperators) == 0)) { throw "illegal/missing seperator string"; } *************** *** 269,287 **** stripTrailingNewlines_inplace(string& s) { ! // The following (harder to read) implementation is much slower on ! // my system (g++ 6.2.1 on Debian): 11.4 vs. 3.9 seconds on ! // 50,000,000 iterations performed on a short CRLF-terminated ! // string---and it is even a bit slower (12.9 seconds) with ! // std::next(it) instead of (it+1). // ! // for (string::reverse_iterator it = s.rbegin(); ! // it != s.rend() && (*it == '\r' || *it == '\n'); /* empty */) { ! // it = string::reverse_iterator(s.erase( (it+1).base() )); ! // } ! ! // Simple and fast ! while (!s.empty() && (s.back() == '\r' || s.back() == '\n')) { ! s.pop_back(); } } --- 269,287 ---- stripTrailingNewlines_inplace(string& s) { ! // Florent Rougon: The following (harder to read) implementation is ! // much slower on my system (g++ 6.2.1 on Debian): 11.4 vs. 3.9 ! // seconds on 50,000,000 iterations performed on a short ! // CRLF-terminated string---and it is even a bit slower (12.9 seconds) ! // with std::next(it) instead of (it+1). // ! for (string::reverse_iterator it = s.rbegin(); ! it != s.rend() && (*it == '\r' || *it == '\n'); /* empty */) { ! it = string::reverse_iterator(s.erase( (it+1).base() )); } + + // Simple and fast but need C++11 + // while (!s.empty() && (s.back() == '\r' || s.back() == '\n')) { + // s.pop_back(); + // } } |