Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
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.

regex_token_iterator::operator!=

Compares iterators for inequality.

bool operator!=(const regex_token_iterator& right);

right

The iterator to compare to.

The member function returns !(*this == right).

 

// std_tr1__regex__regex_token_iterator_operator_ne.cpp 
// compile with: /EHsc 
#include <regex> 
#include <iostream> 
 
typedef std::tr1::regex_token_iterator<const char *> Myiter; 
int main() 
    { 
    const char *pat = "aaxaayaaz"; 
    Myiter::regex_type rx("(a)a"); 
    Myiter next(pat, pat + strlen(pat), rx); 
    Myiter end; 
 
// show whole match 
    for (; next != end; ++next) 
        std::cout << "match == " << next->str() << std::endl; 
    std::cout << std::endl; 
 
// show prefix before match 
    next = Myiter(pat, pat + strlen(pat), rx, -1); 
    for (; next != end; ++next) 
        std::cout << "match == " << next->str() << std::endl; 
    std::cout << std::endl; 
 
// show (a) submatch only 
    next = Myiter(pat, pat + strlen(pat), rx, 1); 
    for (; next != end; ++next) 
        std::cout << "match == " << next->str() << std::endl; 
    std::cout << std::endl; 
 
// show prefixes and submatches 
    std::vector<int> vec; 
    vec.push_back(-1); 
    vec.push_back(1); 
    next = Myiter(pat, pat + strlen(pat), rx, vec); 
    for (; next != end; ++next) 
        std::cout << "match == " << next->str() << std::endl; 
    std::cout << std::endl; 
 
// show prefixes and whole matches 
    int arr[] = {-1, 0}; 
    next = Myiter(pat, pat + strlen(pat), rx, arr); 
    for (; next != end; ++next) 
        std::cout << "match == " << next->str() << std::endl; 
    std::cout << 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 == aa match == aa match == aa match == match == x match == y match == z match == a match == a match == a match == match == a match == x match == a match == y match == a match == z match == match == aa match == x match == aa match == y match == aa match == z

Header: <regex>

Namespace: std::tr1

Community Additions

ADD
Show:
© 2015 Microsoft