Skip to content
Merged
Changes from 1 commit
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
Next Next commit
<iomanip>: Avoid repeating types in quoted() by using `return {m,e,o,…
…w};`.
  • Loading branch information
StephanTLavavej committed Apr 27, 2022
commit c28c5942db6b6e15da90573947a1ded970c5a727
10 changes: 4 additions & 6 deletions stl/inc/iomanip
Original file line number Diff line number Diff line change
Expand Up @@ -218,29 +218,27 @@ _NODISCARD _Quote_out<_Elem, void, size_t> quoted(
++_Size;
}

return _Quote_out<_Elem, void, size_t>(_Ptr, _Size, _Delim, _Escape);
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