std::regex_iterator<BidirIt,CharT,Traits>::operator*,operator->
const value_type& operator*() const; | (1) | (начиная с C++11) |
const value_type* operator->() const; | (2) | (начиная с C++11) |
Извлекает текущий std::match_results из regex_iterator.
Возвращаемое значение
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
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/regex/regex_iterator/operator*