std::sub_match<BidirIt>::operator string_type, std::sub_match<BidirIt>::str
提供: cppreference.com
operator string_type()const; | (1) | |
string_type str()const; | (2) | |
ベースとなる std::basic_string 型のオブジェクトに変換します。
最初のバージョンは暗黙の変換、2番目は明示的な関数です。
目次 |
[編集]引数
(なし)
[編集]戻り値
ベースとなる std::basic_string 型のオブジェクトとしてマッチした文字シーケンスを返します。 matched
メンバが false の場合は空文字列が返されます。
[編集]計算量
ベースとなる文字シーケンスの長さに比例。
[編集]例
Run this code
#include <iostream>#include <regex>#include <string>int main(){std::ssub_match sm;std::string s = sm;// implicit conversionstd::cout<< s.length()<<'\n';}
出力:
0