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