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/<代码>。