-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<string>
: Consider improving conformance for char_traits
#3735
Comments
This is needed by SFINAE. In order to constrain this constructor, we need to make it a function template and introduce a template parameter on which substitution may fail. |
@frederick-vs-ja Can we simply remove this constraint? The constraint is not used elsewhere other than the two cases( |
No. This constraint is added by LWG-3076, which should be considered as a defect report against C++17 (in which CTAD is introduced). |
Wow, this is a missed change from WG21-N2349. We need to implement these C++11 changes. FYI libstdc++ can't make the changes for Edit: |
According to the standard(ref),
char_traits::eq/lt/to_char_type/to_int_type/eq_int_type/not_eof
should take values instead of references as parameters.(
Also in
https://github.com/microsoft/STL/blob/a62109595b6d89e08172fdf4beb75a2670fe0cc9/stl/inc/xstring#L305-L327?plain=1
https://github.com/microsoft/STL/blob/a62109595b6d89e08172fdf4beb75a2670fe0cc9/stl/inc/xstring#L449-L471?plain=1
)
STL/stl/inc/xstring
Lines 193 to 215 in a621095
Also,
int_type
s forchar_traits<char16_t>
,<char32_t>
and<wchar_t>
should beuint_least16_t
,uint_least32_t
andwint_t
respectively. Currently they are defined asunsigned short
,unsigned int
andunsigned short
. --They just works now. However, I think it will be better to use aliases directly, or at least add some static_asserts(e.g.static_assert(std::is_same_v<wint_t,unsigned short>)
.STL/stl/inc/xstring
Lines 337 to 344 in a621095
(
char_traits<char>
,<char8_t>
has no such issue)(off topic) We can safely add
noexcept /*strengthened*/
for this function:STL/stl/inc/xstring
Lines 1402 to 1404 in a621095
(off topic; question) What does the template(line2547~2549) do here?
_Alloc2
is not used in the body, and_Alloc
is directly used as allocator in other member functions.(
Also here; the only another use of this pattern
https://github.com/microsoft/STL/blob/a62109595b6d89e08172fdf4beb75a2670fe0cc9/stl/inc/xstring#L2560-L2566?plain=1
)
STL/stl/inc/xstring
Lines 2547 to 2553 in a621095
The text was updated successfully, but these errors were encountered: