次の方法で共有


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
    文字列の特徴 (traits) クラス。

  • 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 クラス