提高::正则表达式VS的std ::正则表达式 - 无法找到空()方法? [英] boost::regex vs std::regex - can't find empty() method?

查看:140
本文介绍了提高::正则表达式VS的std ::正则表达式 - 无法找到空()方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更换的boost ::正则表达式的std ::正则表达式,因为我们是在我跑到公司使用gcc 4.6与<一个问题href=\"http://www.boost.org/doc/libs/release/libs/regex/doc/html/boost_regex/ref/basic_regex.html#boost_regex.basic_regex.empty\"相对=nofollow> 空() 该类的方法 - 它基本上没有从的boost ::正则表达式到的std ::正则表达式类。我不知道这是否是一个gcc的问题,或者这种方法并没有使之成为C ++ 11标准可言,但是那件code被严重依赖此功能。所以,问题是 - 有在某种程度上C ++ 11 的std ::正则表达式来检查,如果前pression是以往任何时候设定或者我应该坚持的boost ::正则表达式我的余生?

Replacing boost::regex with std::regex since we are using gcc 4.6 in the company I ran into an issue with empty () method of that class - it basically didn't make it from boost::regex into std::regex class. I am not sure whether this is a gcc's issue or this method didn't make it into C++11 standard at all, but that piece of code was heavily depending on this feature. So the question is - is there a way in C++11 std::regex to check if expression was ever set or I should stick to boost::regex for the rest of my life?

推荐答案

空()的std ::正则表达式得到了删除很久以前。 N1507 (2003-09-16)是原始论文建议删除这些内容(搜索什么是无效的/空正前pression?)。正则表达式:这个问题在当时被的std :: TR1执导。它被记录在LWG TR1问题列为议题7.28和包含了如下决议:

empty() got removed from std::regex a long time ago. N1507 (2003-09-16) was the original paper to suggest its removal (search for "What is an invalid/empty regular expression?"). This issue was directed at what then was std::tr1:regex. It was recorded in the LWG tr1 issues lists as issue 7.28 and contained the following resolution:

在科纳讨论。该LWG同意,默认的构造函数应该
  相当于从空字符串施工。离开这个开放
  现在一方面是因为我们需要的措辞前pressing说,部分
  因为它不是清楚,有任何一点有theempty()
  摆在首位成员函数。

Discussed at Kona. The LWG agrees that the default constructor should be equivalent to construction from an empty string. Leaving this open for now partly because we need wording expressing that, and partly because it’s not clear that there’s any point to having theempty() member function in the first place.

N1711 (2004-11-04)为第一TR1草案缺乏 basic_regex ​​::空()。从那里,它从TR1导入C ++ 11没有进一步的讨论。

N1711 (2004-11-04) was the first TR1 draft to lack basic_regex::empty(). From there it got imported from TR1 into C++11 with no further discussion.

这篇关于提高::正则表达式VS的std ::正则表达式 - 无法找到空()方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆