且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从VC ++ 2010中的std :: regex获取字符串模式

更新时间:2023-11-07 20:14:28

我刚看过N3225的第28.4节(标题< regex&gt ; 概要),而且 basic_regex 模板没有成员函数 str

I just looked in N3225, section 28.4 (header <regex> synopsis) and indeed, the basic_regex template has no member function str, and there are no operator<< provided.

段落28.8 / 2提供

The paragraph 28.8/2 provides a little insight on this :



类型特殊化的对象 basic_regex 负责
charT
对象的序列转换为内部表示
没有指定这个
表示所采用的形式,也不能通过对
正则表达式进行操作的算法访问

Objects of type specialization of basic_regex are responsible for converting the sequence of charT objects to an internal representation. It is not specified what form this representation takes, nor how it is accessed by algorithms that operate on regular expressions.

我理解的是, basic_regex 的标准命令可以从 const charT * code>,但不要求实现保留此字符串。

What I understand is that the standard mandates that basic_regex can be constructed from const charT * but does not require the implementation to keep this string.