std::regex_iterator<BidirIt,CharT,Traits>::operator*,operator->
From cppreference.com
< cpp | regex | regex iterator
| const value_type& operator*() const; |
(1) | (C++11以降) |
| const value_type* operator->() const; |
(2) | (C++11以降) |
regex_iteratorから現在のstd::match_resultsを抽出します。
[編集] 戻り値
1) 現在のstd::match_resultsへの参照を返します。
2) 現在のstd::match_resultsへのポインタを返します。
[編集] 例
このコードを実行
#include <iostream> #include <regex> #include <string> int main() { std::string hay{"1.1a2b3cjk34"}; std::regex needle("[1234]"); using Ri = std::regex_iterator<std::string::iterator>; for (Ri it{hay.begin(), hay.end(), needle}, last{}; it != last; ++it) std::cout << it->str(); std::cout << '\n'; }
出力
112334