std::basic_regex::assign
basic_regex& assign( const basic_regex& other ); | (1) | (since C++11) |
|---|---|---|
basic_regex& assign( basic_regex&& that ); | (2) | (since C++11) |
basic_regex& assign( const CharT* s, flag_type f = std::regex_constants::ECMAScript ); | (3) | (since C++11) |
basic_regex& assign( const charT* ptr, size_t count, flag_type f = std::regex_constants::ECMAScript ); | (4) | (since C++11) |
template< class ST, class SA > basic_regex& assign( const std::basic_string<CharT,ST,SA>& str, flag_type f = std::regex_constants::ECMAScript ); | (5) | (since C++11) |
template< class InputIt > basic_regex& assign( InputIt first, InputIt last, flag_type f = std::regex_constants::ECMAScript ); | (6) | (since C++11) |
basic_regex& assign( std::initializer_list<CharT> ilist, flag_type f = std::regex_constants::ECMAScript ); | (7) | (since C++11) |
将内容分配给正则表达式。
1%29分配other...flags()和mark_count()的值等于other.flags()和other.mark_count()打完电话后。
2%29分配other使用移动语义。flags()和mark_count()的值等于other.flags()和other.mark_count()在任务之前。打完电话后,other处于有效但未指定的状态。
3-7%29给正则表达式分配一个字符序列.。语法标志设置为f...mark_count()返回调用后结果子表达式中标记的子表达式的数目。
3%29指定一个以空结尾的字符串,该字符串由s...
4%29分配一个序列count字符,由s...
5%29分配字符串str...
6%29指定范围内的字符[first, last)...
7%29分配初始化程序列表中的字符。ilist...
参数
other | - | another regular expression to assign |
|---|---|---|
s | - | pointer to a character sequence to assign |
str | - | string to assign |
first, last | - | the range of characters to assign |
ilist | - | initializer list containing characters to assign |
类型要求
-输入必须符合输入器的要求。
返回值
*this...
例外
1%29%280%29
2%29
noexcept规格:
noexcept
3-7%29std::regex_error如果提供的正则表达式无效。在这种情况下,对象不会被修改。
例
另见
operator= | assigns the contents (public member function) |
|---|
© cppreference.com在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com

