operator<< <regex>
更新 : 2007 年 11 月
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::tr1::regex rx("c(a*)|(b)");
std::tr1::cmatch mr;
std::tr1::regex_search("xcaaay", mr, rx);
std::tr1::csub_match sub = mr[0];
std::cout << "whole match: " << sub << std::endl;
return (0);
}
whole match: caaa
必要条件
ヘッダー : <regex>
名前空間 : std::tr1