---
name: "__gnu_parallel::_IteratorPair"
section: "3cxx"
platform: "linux"
package: "libstdc++-12-doc"
version: "12.4.0-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/__gnu_parallel::_IteratorPair/3cxx"
---

# \_\_gnu\_parallel::\_IteratorPair(3cxx)

A pair of iterators. The usual iterator operations are applied to both child iterators.

## NAME

\_\_gnu\_parallel::\_IteratorPair\< \_Iterator1, \_Iterator2, \_IteratorCategory \> - A pair of iterators. The usual iterator operations are applied to both child iterators.

## SYNOPSIS

`#include <iterator.h>`

Inherits **std::pair\< \_Iterator1, \_Iterator2 \>**.

### Public Types

typedef **std::iterator\_traits**\< \_Iterator1 \> **\_TraitsType**\
 typedef \_TraitsType::difference\_type **difference\_type**\
 typedef \_Iterator1 **first\_type**\
 The type of the `first` member.  typedef \_IteratorCategory **iterator\_category**\
 typedef **\_IteratorPair** \* **pointer**\
 typedef **\_IteratorPair** & **reference**\
 typedef \_Iterator2 **second\_type**\
 The type of the `second` member.  typedef void **value\_type**\

### Public Member Functions

**\_IteratorPair** (const \_Iterator1 &\_\_first, const \_Iterator2 &\_\_second)\
 **operator \_Iterator2** () const\
 **\_IteratorPair** **operator+** (difference\_type \_\_delta) const\
 **\_IteratorPair** & **operator++** ()\
 const **\_IteratorPair** **operator++** (int)\
 difference\_type **operator-** (const **\_IteratorPair** &\_\_other) const\
 **\_IteratorPair** & **operator--** ()\
 const **\_IteratorPair** **operator--** (int)\
 **\_IteratorPair** & **operator=** (const **\_IteratorPair** &\_\_other)\
 constexpr void **swap** (**pair** &\_\_p) noexcept(\_\_and\_\< \_\_is\_nothrow\_swappable\< \_Iterator1 \>, \_\_is\_nothrow\_swappable\< \_Iterator2 \> \>::value)\
 Swap the first members and then the second members.

### Public Attributes

\_Iterator1 **first**\
 The first member.  \_Iterator2 **second**\
 The second member.

### Related Symbols

(Note that these are not member symbols.)  constexpr **pair**\< typename \_\_decay\_and\_strip\< \_Iterator1 \>::\_\_type, typename \_\_decay\_and\_strip\< \_Iterator2 \>::\_\_type \> **make\_pair** (\_Iterator1 &&\_\_x, \_Iterator2 &&\_\_y)\
 A convenience wrapper for creating a pair from two objects.

constexpr enable\_if\< \_\_and\_\< \_\_is\_swappable\< \_Iterator1 \>, \_\_is\_swappable\< \_Iterator2 \> \>::value \>::type **swap** (**pair**\< \_Iterator1, \_Iterator2 \> &\_\_x, **pair**\< \_Iterator1, \_Iterator2 \> &\_\_y) noexcept(noexcept(\_\_x.swap(\_\_y)))\
 constexpr bool **operator==** (const **pair**\< \_Iterator1, \_Iterator2 \> &\_\_x, const **pair**\< \_Iterator1, \_Iterator2 \> &\_\_y)\
 Two pairs of the same type are equal iff their members are equal.  constexpr bool **operator\<** (const **pair**\< \_Iterator1, \_Iterator2 \> &\_\_x, const **pair**\< \_Iterator1, \_Iterator2 \> &\_\_y)\
 constexpr bool **operator!=** (const **pair**\< \_Iterator1, \_Iterator2 \> &\_\_x, const **pair**\< \_Iterator1, \_Iterator2 \> &\_\_y)\
 Uses `operator==` to find the result.  constexpr bool **operator\>** (const **pair**\< \_Iterator1, \_Iterator2 \> &\_\_x, const **pair**\< \_Iterator1, \_Iterator2 \> &\_\_y)\
 Uses `operator<` to find the result.  constexpr bool **operator\<=** (const **pair**\< \_Iterator1, \_Iterator2 \> &\_\_x, const **pair**\< \_Iterator1, \_Iterator2 \> &\_\_y)\
 Uses `operator<` to find the result.  constexpr bool **operator\>=** (const **pair**\< \_Iterator1, \_Iterator2 \> &\_\_x, const **pair**\< \_Iterator1, \_Iterator2 \> &\_\_y)\
 Uses `operator<` to find the result.

## Detailed Description

### template\<typename \_Iterator1, typename \_Iterator2, typename \_IteratorCategory\>

class \_\_gnu\_parallel::\_IteratorPair\< \_Iterator1, \_Iterator2, \_IteratorCategory \>"A pair of iterators. The usual iterator operations are applied to both child iterators.

## Member Typedef Documentation

### typedef \_Iterator1 std::pair\< \_Iterator1 , \_Iterator2 \>::first\_type` [inherited]`

The type of the `first` member.

### typedef \_Iterator2 std::pair\< \_Iterator1 , \_Iterator2 \>::second\_type` [inherited]`

The type of the `second` member.

## Member Function Documentation

### constexpr void std::pair\< \_Iterator1 , \_Iterator2 \>::swap (pair\< \_Iterator1, \_Iterator2 \> & \_\_p)` [inline]`, ` [constexpr]`, ` [noexcept]`, ` [inherited]`

Swap the first members and then the second members.

## Friends And Related Symbol Documentation

### constexpr pair\< typename \_\_decay\_and\_strip\< \_Iterator1 \>::\_\_type, typename \_\_decay\_and\_strip\< \_Iterator2 \>::\_\_type \> make\_pair (\_Iterator1 && \_\_x, \_Iterator2 && \_\_y)` [related]`

A convenience wrapper for creating a pair from two objects.

**Parameters**

*\_\_x* The first object. \
 *\_\_y* The second object.

**Returns**

A newly-constructed pair\<\> object of the appropriate type.

The C++98 standard says the objects are passed by reference-to-const, but C++03 says they are passed by value (this was LWG issue #181).

Since C++11 they have been passed by forwarding reference and then forwarded to the new members of the pair. To create a pair with a member of reference type, pass a `reference_wrapper` to this function.

### constexpr bool operator!= (const pair\< \_Iterator1 , \_Iterator2 \> & \_\_x, const pair\< \_Iterator1 , \_Iterator2 \> & \_\_y)` [related]`

Uses `operator==` to find the result.

### constexpr bool operator\< (const pair\< \_Iterator1 , \_Iterator2 \> & \_\_x, const pair\< \_Iterator1 , \_Iterator2 \> & \_\_y)` [related]`

Defines a lexicographical order for pairs.

For two pairs of the same type, `P` is ordered before `Q` if `P.first` is less than `Q.first`, or if `P.first` and `Q.first` are equivalent (neither is less than the other) and `P.second` is less than `Q.second`.

### constexpr bool operator\<= (const pair\< \_Iterator1 , \_Iterator2 \> & \_\_x, const pair\< \_Iterator1 , \_Iterator2 \> & \_\_y)` [related]`

Uses `operator<` to find the result.

### constexpr bool operator== (const pair\< \_Iterator1 , \_Iterator2 \> & \_\_x, const pair\< \_Iterator1 , \_Iterator2 \> & \_\_y)` [related]`

Two pairs of the same type are equal iff their members are equal.

### constexpr bool operator\> (const pair\< \_Iterator1 , \_Iterator2 \> & \_\_x, const pair\< \_Iterator1 , \_Iterator2 \> & \_\_y)` [related]`

Uses `operator<` to find the result.

### constexpr bool operator\>= (const pair\< \_Iterator1 , \_Iterator2 \> & \_\_x, const pair\< \_Iterator1 , \_Iterator2 \> & \_\_y)` [related]`

Uses `operator<` to find the result.

### constexpr enable\_if\< \_\_and\_\< \_\_is\_swappable\< \_Iterator1 \>, \_\_is\_swappable\< \_Iterator2 \> \>::value \>::type swap (pair\< \_Iterator1 , \_Iterator2 \> & \_\_x, pair\< \_Iterator1 , \_Iterator2 \> & \_\_y)` [related]`

Swap overload for pairs. Calls std::pair::swap().

**Note**

This std::swap overload is not declared in C++03 mode, which has performance implications, e.g. see https://gcc.gnu.org/PR38466

## Member Data Documentation

### \_Iterator1 std::pair\< \_Iterator1 , \_Iterator2 \>::first` [inherited]`

The first member.

### \_Iterator2 std::pair\< \_Iterator1 , \_Iterator2 \>::second` [inherited]`

The second member.

## Author

Generated automatically by Doxygen for libstdc++ from the source code.
