std::basic_regex<CharT,Traits>::assign
来自 cppreference.cn
< cpp | regex | basic regex
basic_regex& assign( const basic_regex& other ); |
(1) | (since C++11) |
basic_regex& assign( basic_regex&& other ) noexcept; |
(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, std::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, |
(5) | (since C++11) |
template< class InputIt > basic_regex& assign( InputIt first, InputIt last, |
(6) | (since C++11) |
basic_regex& assign( std::initializer_list<CharT> ilist, flag_type f = std::regex_constants::ECMAScript ); |
(7) | (since C++11) |
将内容赋值给正则表达式。
2) 使用移动语义赋值 other 的内容。在赋值之前,flags() 和 mark_count() 等价于 other.flags() 和 other.mark_count() 的值。 在调用之后,other 处于有效的但不指定的状态。
3) 赋值由 s 指向的空终止字符串。
4) 赋值由 s 指向的 count 个字符的序列。
5) 赋值字符串 str。
6) 赋值范围
[
first,
last)
中的字符。7) 赋值初始化列表 ilist 中的字符。
内容 |
[edit] 参数
other | - | 要赋值的另一个正则表达式 |
s | - | 指向要赋值的字符序列的指针 |
str | - | 要赋值的字符串 |
first, last | - | 要赋值的字符范围 |
ilist | - | 包含要赋值字符的初始化列表 |
类型要求 | ||
-InputIt 必须满足 LegacyInputIterator 的要求。 |
[edit] 返回值
*this
[edit] 异常
1) 可能抛出实现定义的异常。
3-7) 如果提供的正则表达式无效,则抛出 std::regex_error 异常。 在这种情况下,对象不会被修改。
[edit] 示例
本节内容不完整 原因:没有示例 |
[edit] 参见
赋值内容 (public member function) |