std::basic_regex::assign

basic_regex& assign( const basic_regex& other );
(1) (C++11 起)
basic_regex& assign( basic_regex&& that ) noexcept;
(2) (C++11 起)
basic_regex& assign( const CharT* s,
                     flag_type f = std::regex_constants::ECMAScript );
(3) (C++11 起)
basic_regex& assign( const charT* ptr, size_t count,
                     flag_type f = std::regex_constants::ECMAScript );
(4) (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) (C++11 起)
template< class InputIt >

basic_regex& assign( InputIt first, InputIt last,

                     flag_type f = std::regex_constants::ECMAScript );
(6) (C++11 起)
basic_regex& assign( std::initializer_list<CharT> ilist,
                     flag_type f = std::regex_constants::ECMAScript );
(7) (C++11 起)

赋值内容给正则表达式。

1) 赋值 other 的内容。调用后 flags()mark_count() 等于 other.flags()other.mark_count() 的值。
2) 用移动语义赋值 other 的内容。 flags()mark_count() 等于 other.flags()other.mark_count() 在赋值前的值。调用后, other 在合法但未指定的状态。
3-7) 赋值字符序列给正则表达式。设置语法标志为 f 。调用后 mark_count() 产生的子表达式中的有标记子表达式数。
3) 赋值 s 所指向的空终止字符串。
4) 赋值 s 所指向的 count 个字符序列。
5) 赋值 string str
6) 赋值范围 [first, last) 中的字符。
7) 赋值 initializer_list ilist 中的字符。

目录

参数

other - 要赋值的另一正则表达式
s - 指向要赋值的字符序列的指针
str - 要赋值的 string
first, last - 要赋值的字符范围
ilist - 含要赋值的字符的 initializer_list
类型要求
-
InputIt 必须满足 InputIterator 的要求。

返回值

*this

异常

1) (无)
3-7) 若提供的正则表达式非法则为 std::regex_error 。该情况下不修改对象。

示例

参阅

赋值内容
(公开成员函数)

版本历史

  • (当前 | 先前 2017年9月28日 (四) 22:22Fruderica讨论 | 贡献. . (2,644字节) (-1,714). . (撤销)
  • 当前 | 先前 2014年10月26日 (日) 18:05P12bot讨论 | 贡献 . . (4,358字节) (0). . (Fix some translations) (撤销)
  • 当前 | 先前 2013年7月2日 (二) 09:29P12bot讨论 | 贡献 . . (4,358字节) (-305). . (Use {{lc}}. Update links. Various fixes.) (撤销)
  • 当前 | 先前 2012年11月2日 (五) 12:51P12bot讨论 | 贡献 . . (4,663字节) (+289). . (r2.7.3) (机器人添加:de, en, es, fr, it, ja, pt, ru) (撤销)
  • 当前 | 先前 2012年10月27日 (六) 09:06P12讨论 | 贡献 . . (4,374字节) (0). . (1个修订: Translate from the English version) (撤销)
  • 当前 | 先前 2012年10月26日 (五) 06:00TranslationBot讨论 | 贡献. . (4,374字节) (-100). . (Translated from the English version using Google Translate) (撤销)
  • 当前 | 先前 2012年10月25日 (四) 15:32P12讨论 | 贡献 . . (4,474字节) (0). . (1个修订: Translate from the English version) (撤销)
  • 当前 | 先前) 2012年10月25日 (四) 12:00TranslationBot讨论 | 贡献. . (4,474字节) (+4,474). . (Translated from the English version using Google Translate)