std::regex does not work properly with gcc 4.8

This commit is contained in:
vsr 2021-10-26 20:10:54 +03:00
parent 300e5f1bc5
commit 890187d6e1

View File

@ -29,10 +29,10 @@
#include <Basics_DirUtils.hxx> #include <Basics_DirUtils.hxx>
#include <Basics_Utils.hxx> #include <Basics_Utils.hxx>
#include <regex>
#include <cstdlib> // getenv, system #include <cstdlib> // getenv, system
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/regex.hpp>
namespace boofs = boost::filesystem; namespace boofs = boost::filesystem;
#ifdef WIN32 #ifdef WIN32
@ -203,12 +203,12 @@ namespace
{ {
{// round1 {// round1
enum { SCHEME = 2, AUTHORITY = 4, PATH = 5 }; // sub-strings enum { SCHEME = 2, AUTHORITY = 4, PATH = 5 }; // sub-strings
std::regex urlRegex ( R"(^(([^:\/?#]+):)?(//([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?)", boost::regex urlRegex ( R"(^(([^:\/?#]+):)?(//([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?)",
std::regex::extended ); boost::regex::extended );
std::smatch matchResult; boost::smatch matchResult;
libraryFile._isURL = false; libraryFile._isURL = false;
if ( std::regex_match( libraryFile._name, matchResult, urlRegex )) if ( boost::regex_match( libraryFile._name, matchResult, urlRegex ))
libraryFile._isURL = ( !matchResult.str( SCHEME ).empty() && libraryFile._isURL = ( !matchResult.str( SCHEME ).empty() &&
!matchResult.str( AUTHORITY ).empty() && !matchResult.str( AUTHORITY ).empty() &&
!matchResult.str( PATH ).empty() ); !matchResult.str( PATH ).empty() );
@ -217,12 +217,12 @@ namespace
return true; return true;
{// round2 {// round2
enum { HOST = 2, PORT = 3, PATH = 4 }; // sub-strings enum { HOST = 2, PORT = 3, PATH = 4 }; // sub-strings
std::regex urlRegex ( R"(^(([^:\/?#]+):)?([^/]+)?(/[^#]*))", boost::regex urlRegex ( R"(^(([^:\/?#]+):)?([^/]+)?(/[^#]*))",
std::regex::extended ); boost::regex::extended );
std::smatch matchResult; boost::smatch matchResult;
libraryFile._isURL = false; libraryFile._isURL = false;
if ( std::regex_match( libraryFile._name, matchResult, urlRegex )) if ( boost::regex_match( libraryFile._name, matchResult, urlRegex ))
libraryFile._isURL = ( !matchResult.str( HOST ).empty() && libraryFile._isURL = ( !matchResult.str( HOST ).empty() &&
!matchResult.str( PORT ).empty() && !matchResult.str( PORT ).empty() &&
!matchResult.str( PATH ).empty() ); !matchResult.str( PATH ).empty() );