Namespaces
Variants
Views
Actions

std::sub_match::operator string_type, std::sub_match::str

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

Template:ddcl list begin <tr class="t-dcl-sep"><td></td><td></td><td></td></tr>

<tr class="t-dcl ">

<td >
operator string_type() const;
</td>

<td > (1) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl-sep"><td></td><td></td><td></td></tr>

<tr class="t-dcl ">

<td >
string_type str() const;
</td>

<td > (2) </td> <td class="t-dcl-nopad"> </td> </tr> Template:ddcl list end

1) Implicitly converts to an object of the underlying std::basic_string type.

2) Explicitly converts to an object of the underlying std::basic_string type.

Contents

Parameters

(none)

Return value

Returns the matched character sequence as an object of the underlying std::basic_string type. If the matched member is false then the empty string is returned.

Complexity

Linear in the length of the underlying character sequence.

Example

std::ssub_match sm;
std::string s = sm;  // implicit conversion
std::cout << s.length() << '\n';

Output:

​0​