This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.
basic_regex
should be created/assigned from initializer listsSection: 28.6.7.2 [re.regex.construct] Status: C++11 Submitter: Alisdair Meredith Opened: 2009-03-11 Last modified: 2016-01-28
Priority: Not Prioritized
View other active issues in [re.regex.construct].
View all other issues in [re.regex.construct].
View all issues with C++11 status.
Discussion:
Addresses UK 317 and JP 74
UK 317:
basic_string
has both a constructor and an assignment operator that accepts an initializer list,basic_regex
should have the same.
JP 74:
basic_regex & operator= (initializer_list<T>);
is not defined.
[ Batavia (2009-05): ]
UK 317 asks for both assignment and constructor, but the requested constructor is already present in the current Working Paper. We agree with the proposed resolution. Move to Tentatively Ready.
Proposed resolution:
Change 28.6.7 [re.regex]:
template <class charT, class traits = regex_traits<charT> > class basic_regex { ... basic_regex& operator=(const charT* ptr); basic_regex& operator=(initializer_list<charT> il); template <class ST, class SA> basic_regex& operator=(const basic_string<charT, ST, SA>& p); ... };
Add in 28.6.7.2 [re.regex.construct]:
-20- ...
basic_regex& operator=(initializer_list<charT> il);-21- Effects: returns
assign(il.begin(), il.end());