operator<< <regex>

插入sub_match在流。

template<class Elem, class IOtraits, class Alloc, class BidIt>
    basic_ostream<Elem, IOtraits>&
    operator<<(basic_ostream<Elem, IOtraits>& os,
        const sub_match<BidIt>& right);

参数

  • Elem
    元素类型。

  • IOtraits
    字符串特征选件类。

  • Alloc
    分配器选件类。

  • BidIt
    迭代器类型。

  • os
    输出流。

  • right
    要插入的对象。

备注

模板运算符返回 os << right.str()。

示例

 

// std_tr1__regex__operator_ins.cpp 
// compile with: /EHsc 
#include <regex> 
#include <iostream> 
 
int main() 
    { 
    std::regex rx("c(a*)|(b)"); 
    std::cmatch mr; 
 
    std::regex_search("xcaaay", mr, rx); 
 
    std::csub_match sub = mr[0]; 
    std::cout << "whole match: " << sub << std::endl; 
 
    return (0); 
    } 
 
  

要求

标头: <regex>

命名空间: std

请参见

参考

<regex>

sub_match Class