Namespaces
Variants
Views
Actions

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

From cppreference.com
operator string_type() const;
(1)
string_type str() const;
(2)

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

[edit] Parameters

(none)

[edit] 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.

[edit] Complexity

Linear in the length of the underlying character sequence.

[edit] Example

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

Output:

​0​