std::sub_match::str
| operator string_type() const; | (1) |  | 
|---|---|---|
| string_type str() const; | (2) |  | 
转换为基础对象的对象。std::basic_string类型。
第一个版本是隐式转换,三是显式转换。
参数
%280%29
返回值
的对象返回匹配的字符序列。std::basic_string类型。如果matched成员是假的然后返回空字符串。
复杂性
与基本字符序列的长度成线性。
例
二次
#include <iostream>
#include <regex>
#include <string>
int main()
{
  std::ssub_match sm;
  std::string s = sm;  // implicit conversion
  std::cout << s.length() << '\n';
}二次
产出:
二次
0二次
 © cppreference.com在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com

