Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ boost::regex和std::regex之间的不一致?_C++_Regex_C++11_Boost - Fatal编程技术网

C++ boost::regex和std::regex之间的不一致?

C++ boost::regex和std::regex之间的不一致?,c++,regex,c++11,boost,C++,Regex,C++11,Boost,我正在使用boost::regex进行编码,它似乎没有给出与C++11的std::regex相同的结果 考虑以下简单代码: #include <string> #include <iostream> #if defined(_MSC_VER) || (__cplusplus >= 201103L) #include <regex> #else // defined(_MSC_VER) || (__cplusplus >= 201103L) #inc

我正在使用
boost::regex
进行编码,它似乎没有给出与C++11的
std::regex
相同的结果

考虑以下简单代码:

#include <string>
#include <iostream>
#if defined(_MSC_VER) || (__cplusplus >= 201103L)
#include <regex>
#else // defined(_MSC_VER) || (__cplusplus >= 201103L)
#include <boost/regex.hpp>
#endif // defined(_MSC_VER) || (__cplusplus >= 201103L)

namespace {
#if defined(_MSC_VER) || (__cplusplus >= 201103L)
using std::regex;
using std::regex_replace;
#else // defined(_MSC_VER) || (__cplusplus >= 201103L)
using boost::regex;
using boost::regex_replace;
#endif // defined(_MSC_VER) || (__cplusplus >= 201103L)
} // namespace

int main() {
    std::string input = "abc.txt";
    ::regex re("[.]", ::regex::extended);

    std::string output = ::regex_replace(input, re, "\\.");

    std::cout << "Result : " << output << "\n";
    return 0;
}
#包括
#包括
#如果定义(_MSC_VER)| |(u cplusplus>=201103L)
#包括
#else//defined(_MSC_VER)| |(_cplusplus>=201103L)
#包括
#endif//defined(_MSC_VER)| |(_cplusplus>=201103L)
名称空间{
#如果定义(_MSC_VER)| |(u cplusplus>=201103L)
使用std::regex;
使用std::regex_替换;
#else//defined(_MSC_VER)| |(_cplusplus>=201103L)
使用boost::regex;
使用boost::regex_替换;
#endif//defined(_MSC_VER)| |(_cplusplus>=201103L)
}//名称空间
int main(){
std::string input=“abc.txt”;
::regex-re(“[.]”,::regex::extended);
字符串输出=::regex\u replace(输入,re,“\\”);

std::cout我不确定它是否经过审议。
有一个<代码> Boo::ReXExyMeals::FrastByListal[/Cord],它可以用作<代码> ReExxRead < /C> >的第四个参数,然后可以得到与STD::ReExxIORE替换相同的结果。但是在标准C++库中没有<代码> FrastByListalAuth/<代码>。