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