Namespaces
Variants
Views
Actions

std::swap(std::match_results)

From cppreference.com
< cpp‎ | regex‎ | match results
Revision as of 12:12, 2 November 2012 by P12bot (Talk | contribs)

Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <regex>
</td>

<td></td> <td></td> <tr class="t-dcl ">

<td >
template< class BidirIt, class Alloc >

bool operator==( match_results<BidirIt,Alloc>& lhs,

                 match_results<BidirIt,Alloc>& rhs );
</td>

<td > (1) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
template< class BidirIt, class Alloc >

bool operator!=( match_results<BidirIt,Alloc>& lhs,

                 match_results<BidirIt,Alloc>& rhs );
</td>

<td > (2) </td> <td > (since C++11) </td> </tr> Template:ddcl list end

Compares two match_results objects.

Two match_results are equal if the following conditions are met:

  • neither of the objects is ready, or
  • both match results are ready and the following conditions are met:
  • lhs.empty() and rhs.empty(), or
  • !lhs.empty() and !rhs.empty() and the following conditions are met:
  • lhs.prefix() == rhs.prefix()
  • std::equal(lhs.begin(), lhs.end(), rhs.begin())
  • lhs.suffix() == rhs.suffix()
1) Checks if lhs and rhs are equal.
2) Checks if lhs and rhs are not equal.

Contents

Parameters

lhs, rhs - match results to compare
Type requirements
-
BidirIt must meet the requirements of BidirectionalIterator.
-
Alloc must meet the requirements of Allocator.

Return value

1) true if lhs and rhs are equal, false otherwise.
2) true if lhs and rhs are not equal, false otherwise.

Exceptions

(none)

Example