std::basic_regex<CharT,Traits>::assign

出自cppreference.com
< cpp‎ | regex‎ | basic regex
 
 
 
正則表達式庫
(C++11)
演算法
迭代器
異常
特徵
常量
(C++11)
正則表達式文法
 
 
basic_regex& assign( const basic_regex& other );
(1) (C++11 起)
basic_regex& assign( basic_regex&& other ) 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, std::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) 賦值字元串 str
6) 賦值範圍 [firstlast) 中的字元。
7) 賦值初始化式列表 ilist 中的字元。

目錄

[編輯] 參數

other - 要賦值的另一正則表達式
s - 指向要賦值的字元序列的指針
str - 要賦值的字元串
first, last - 要賦值的字元範圍
ilist - 含要賦值的字元的初始化式列表
類型要求
-
InputIt 必須滿足老式輸入迭代器 (LegacyInputIterator)

[編輯] 返回值

*this

[編輯] 異常

1) 可能會拋出由實現定義的異常。
3-7) 若提供的正則表達式非法則為 std::regex_error。該情況下不修改對象。

[編輯] 示例

[編輯] 參閱

賦值內容
(公開成員函數) [編輯]