---
name: "std::tr1::sub_match"
section: "3cxx"
platform: "linux"
package: "libstdc++6-4.4-doc"
version: "4.4.5-8"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/std::tr1::sub_match"
---

# std::tr1::sub\_match(3cxx)

## NAME

std::tr1::sub\_match -

## SYNOPSIS

Inherits **pair\< \_BiIter, \_BiIter \>**.

### Public Types

typedef **iterator\_traits**\< \_BiIter \>::difference\_type **difference\_type**\
 typedef \_BiIter **first\_type**\
 typedef \_BiIter **iterator**\
 typedef \_BiIter **second\_type**\
 typedef **iterator\_traits**\< \_BiIter \>::value\_type **value\_type**\

### Public Member Functions

int **compare** (const **sub\_match** &\_\_s) const \
 int **compare** (const **basic\_string**\< value\_type \> &\_\_s) const \
 int **compare** (const value\_type \*\_\_s) const \
 difference\_type **length** () const \
 **operator basic\_string\< value\_type \>** () const \
 **basic\_string**\< value\_type \> **str** () const \
 void **swap** (**pair** &&\_\_p)\

### Public Attributes

\_BiIter **first**\
 bool **matched**\
 \_BiIter **second**\

## Detailed Description

### template\<typename \_BiIter\> class std::tr1::sub\_match\< \_BiIter \>

A sequence of characters matched by a particular marked sub-expression.

An object of this class is essentially a pair of iterators marking a matched subexpression within a regular expression pattern match. Such objects can be converted to and compared with **std::basic\_string** objects of a similar base character type as the pattern matched by the regular expression.

The iterators that make up the pair are the usual half-open interval referencing the actual original pattern matched.

Definition at line 1086 of file tr1\_impl/regex.

## Member Typedef Documentation

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

`first_type` is the first bound type

Definition at line 69 of file stl\_pair.h.

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

`second_type` is the second bound type

Definition at line 70 of file stl\_pair.h.

## Member Function Documentation

### template\<typename \_BiIter\> int std::tr1::sub\_match\< \_BiIter \>::compare (const sub\_match\< \_BiIter \> & \_\_s) const` [inline]`

Compares this and another matched sequence. **Parameters:**

*s* Another matched sequence to compare to this one.

**Return values:**

*\<0* this matched sequence will collate before `s`. \
 *=0* this matched sequence is equivalent to `s`. \
 *\<0* this matched sequence will collate after `s`.

Definition at line 1144 of file tr1\_impl/regex.

Referenced by std::tr1::operator!=(), std::tr1::operator==(), std::tr1::operator\>(), and std::tr1::operator\>=().

### template\<typename \_BiIter\> int std::tr1::sub\_match\< \_BiIter \>::compare (const basic\_string\< value\_type \> & \_\_s) const` [inline]`

Compares this **sub\_match** to a string. **Parameters:**

*s* A string to compare to this **sub\_match**.

**Return values:**

*\<0* this matched sequence will collate before `s`. \
 *=0* this matched sequence is equivalent to `s`. \
 *\<0* this matched sequence will collate after `s`.

Definition at line 1157 of file tr1\_impl/regex.

### template\<typename \_BiIter\> int std::tr1::sub\_match\< \_BiIter \>::compare (const value\_type \* \_\_s) const` [inline]`

Compares this **sub\_match** to a C-style string. **Parameters:**

*s* A C-style string to compare to this **sub\_match**.

**Return values:**

*\<0* this matched sequence will collate before `s`. \
 *=0* this matched sequence is equivalent to `s`. \
 *\<0* this matched sequence will collate after `s`.

Definition at line 1170 of file tr1\_impl/regex.

### template\<typename \_BiIter\> difference\_type std::tr1::sub\_match\< \_BiIter \>::length () const` [inline]` Gets the length of the matching sequence.

Definition at line 1101 of file tr1\_impl/regex.

### template\<typename \_BiIter\> std::tr1::sub\_match\< \_BiIter \>::operator basic\_string\< value\_type \> () const` [inline]`

Gets the matching sequence as a string. **Returns:**

the matching sequence as a string.

This is the implicit conversion operator. It is identical to the **str()** member function except that it will want to pop up in unexpected places and cause a great deal of confusion and cursing from the unwary.

Definition at line 1114 of file tr1\_impl/regex.

### template\<typename \_BiIter\> basic\_string\<value\_type\> std::tr1::sub\_match\< \_BiIter \>::str () const` [inline]`

Gets the matching sequence as a string. **Returns:**

the matching sequence as a string.

Definition at line 1127 of file tr1\_impl/regex.

Referenced by std::tr1::sub\_match\< \_Bi\_iter \>::compare(), std::tr1::operator!=(), std::tr1::operator\<(), std::tr1::operator\<=(), std::tr1::operator==(), std::tr1::operator\>(), and std::tr1::operator\>=().

## Member Data Documentation

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

`first` is a copy of the first object

Definition at line 72 of file stl\_pair.h.

Referenced by std::tr1::sub\_match\< \_Bi\_iter \>::length(), std::tr1::sub\_match\< \_Bi\_iter \>::operator basic\_string\< value\_type \>(), and std::tr1::sub\_match\< \_Bi\_iter \>::str().

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

`second` is a copy of the second object

Definition at line 73 of file stl\_pair.h.

Referenced by std::tr1::sub\_match\< \_Bi\_iter \>::length(), std::tr1::sub\_match\< \_Bi\_iter \>::operator basic\_string\< value\_type \>(), and std::tr1::sub\_match\< \_Bi\_iter \>::str().

## Author

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