std::match_results<BidirIt,Alloc>::size
提供: cppreference.com
< cpp | regex | match results
size_type size() const noexcept; |
(C++11以上) | |
部分マッチの数、すなわち std::distance(begin(), end()) を返します。
*this
が成功したマッチの結果を表していない場合は 0
を返します。
目次 |
[編集] 引数
(なし)
[編集] 戻り値
部分マッチの数。
[編集] 計算量
一定。
[編集] 例
Run this code
#include <iostream> #include <regex> #include <string> int main() { std::regex re("a(a)*b"); std::string target("aaab"); std::smatch sm; std::cout << sm.size() << '\n'; std::regex_match(target, sm, re); std::cout << sm.size() << '\n'; }
出力:
0 2
[編集] 関連項目
部分マッチのリストの先頭を指すイテレータを返します (パブリックメンバ関数) | |
部分マッチのリストの終端を指すイテレータを返します (パブリックメンバ関数) |