std::match_results<BidirIt,Alloc>::size
提供: cppreference.com
<tbody>
</tbody>
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
関連項目
| 部分マッチのリストの先頭を指すイテレータを返します (パブリックメンバ関数) | |
| 部分マッチのリストの終端を指すイテレータを返します (パブリックメンバ関数) |