From 120a30e94b6a8fdba03c5c3eb66b08eaa8065122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Kvalsvik?= Date: Mon, 25 Apr 2016 16:34:24 +0200 Subject: [PATCH] Replace std::isspace in parser; add \r to is_sep --- opm/parser/eclipse/Parser/Parser.cpp | 7 ++----- opm/parser/eclipse/RawDeck/RawConsts.hpp | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/opm/parser/eclipse/Parser/Parser.cpp b/opm/parser/eclipse/Parser/Parser.cpp index 59a762705..5c957b1b6 100644 --- a/opm/parser/eclipse/Parser/Parser.cpp +++ b/opm/parser/eclipse/Parser/Parser.cpp @@ -99,19 +99,16 @@ namespace Opm { template< typename Itr > static inline Itr trim_left( Itr begin, Itr end ) { - const auto ws = []( char ch ) { return std::isspace( ch ); }; - return std::find_if_not( begin, end, ws ); + return std::find_if_not( begin, end, RawConsts::is_separator ); } template< typename Itr > static inline Itr trim_right( Itr begin, Itr end ) { - const auto ws = []( char ch ) { return std::isspace( ch ); }; - std::reverse_iterator< Itr > rbegin( end ); std::reverse_iterator< Itr > rend( begin ); - return std::find_if_not( rbegin, rend, ws ).base(); + return std::find_if_not( rbegin, rend, RawConsts::is_separator ).base(); } static inline string_view trim( string_view str ) { diff --git a/opm/parser/eclipse/RawDeck/RawConsts.hpp b/opm/parser/eclipse/RawDeck/RawConsts.hpp index e20312342..a0595d9a5 100644 --- a/opm/parser/eclipse/RawDeck/RawConsts.hpp +++ b/opm/parser/eclipse/RawDeck/RawConsts.hpp @@ -36,7 +36,7 @@ namespace Opm { const unsigned int maxKeywordLength = 8; static inline bool is_separator( char ch ) { - return ' ' == ch || '\n' == ch || '\t' == ch; + return ' ' == ch || '\n' == ch || '\t' == ch || '\r' == ch; } static inline bool is_quote( char ch ) {