Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer


Compares iterators for equality.

bool operator==(const regex_iterator& right);


The iterator to compare to.

The member function returns true if *this and right are both end-of-sequence iterators or if neither is an end-of-sequence iterator and begin == right.begin, end == right.end, pregex == right.pregex, and flags == right.flags. Otherwise it returns false.


// std_tr1__regex__regex_iterator_operator_as.cpp 
// compile with: /EHsc 
#include <regex> 
#include <iostream> 
typedef std::tr1::regex_iterator<const char *> Myiter; 
int main() 
    const char *pat = "axayaz"; 
    Myiter::regex_type rx("a"); 
    Myiter next(pat, pat + strlen(pat), rx); 
    Myiter end; 
    for (; next != end; ++next) 
        std::cout << "match == " << next->str() << std::endl; 
// other members 
    Myiter it1(pat, pat + strlen(pat), rx); 
    Myiter it2(it1); 
    next = it1; 
    Myiter::iterator_category cat = std::forward_iterator_tag(); 
    Myiter::difference_type dif = -3; 
    Myiter::value_type mr = *it1; 
    Myiter::reference ref = mr; 
    Myiter::pointer ptr = &ref; 
    dif = dif; // to quiet "unused" warnings 
    ptr = ptr; 
    return (0); 
match == a match == a match == a

Header: <regex>

Namespace: std::tr1

© 2016 Microsoft