Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions stl/inc/iomanip
Original file line number Diff line number Diff line change
Expand Up @@ -213,34 +213,28 @@ struct _Quote_out { // store pointer/length for string
template <class _Elem>
_NODISCARD _Quote_out<_Elem, void, size_t> quoted(
const _Elem* _Ptr, _Elem _Delim = _Elem('"'), _Elem _Escape = _Elem('\\')) {
size_t _Size = 0;
while (_Ptr[_Size] != _Elem(0)) {
++_Size;
}

return _Quote_out<_Elem, void, size_t>(_Ptr, _Size, _Delim, _Escape);
const size_t _Size = char_traits<_Elem>::length(_Ptr);
Comment thread
StephanTLavavej marked this conversation as resolved.
return {_Ptr, _Size, _Delim, _Escape};
}

template <class _Elem, class _Traits, class _Alloc>
_NODISCARD _Quote_out<_Elem, _Traits, typename basic_string<_Elem, _Traits, _Alloc>::size_type> quoted(
const basic_string<_Elem, _Traits, _Alloc>& _Str, _Elem _Delim = _Elem('"'), _Elem _Escape = _Elem('\\')) {
using _Qobj = _Quote_out<_Elem, _Traits, typename basic_string<_Elem, _Traits, _Alloc>::size_type>;
return _Qobj(_Str.c_str(), _Str.size(), _Delim, _Escape);
return {_Str.c_str(), _Str.size(), _Delim, _Escape};
}

#if _HAS_CXX17
template <class _Elem, class _Traits>
_NODISCARD _Quote_out<_Elem, _Traits, size_t> quoted(
const basic_string_view<_Elem, _Traits> _Str, _Elem _Delim = _Elem('"'), _Elem _Escape = _Elem('\\')) {
using _Qobj = _Quote_out<_Elem, _Traits, size_t>;
return _Qobj(_Str.data(), _Str.size(), _Delim, _Escape);
return {_Str.data(), _Str.size(), _Delim, _Escape};
}
#endif // _HAS_CXX17

template <class _Elem, class _Traits, class _Alloc>
_NODISCARD _Quote_in<_Elem, _Traits, _Alloc> quoted(
basic_string<_Elem, _Traits, _Alloc>& _Str, _Elem _Delim = _Elem('"'), _Elem _Escape = _Elem('\\')) {
return _Quote_in<_Elem, _Traits, _Alloc>(_Str, _Delim, _Escape);
return {_Str, _Delim, _Escape};
}

template <class _Elem, class _Traits, class _QuTraits, class _Sizet>
Expand Down