名前空間
変種

std::sub_match<BidirIt>::operator string_type, std::sub_match<BidirIt>::str

提供: cppreference.com
<tbody> </tbody>
operator string_type() const;
(1)
string_type str() const;
(2)

ベースとなる std::basic_string 型のオブジェクトに変換します。

最初のバージョンは暗黙の変換、2番目は明示的な関数です。

引数

(なし)

戻り値

ベースとなる std::basic_string 型のオブジェクトとしてマッチした文字シーケンスを返します。 matched メンバが false の場合は空文字列が返されます。

計算量

ベースとなる文字シーケンスの長さに比例。

#include <iostream>
#include <regex>
#include <string>
int main()
{
  std::ssub_match sm;
  std::string s = sm;  // implicit conversion
  std::cout << s.length() << '\n';
}

出力:

0
Morty Proxy This is a proxified and sanitized view of the page, visit original site.