Correct basic_string_view from string ctor

This commit is contained in:
Victor Zverovich 2019-11-14 05:57:23 -08:00
parent 1f918159ed
commit 0d6dd0cc6a

View File

@ -296,10 +296,11 @@ template <typename Char> class basic_string_view {
: data_(s), size_(std::char_traits<Char>::length(s)) {} : data_(s), size_(std::char_traits<Char>::length(s)) {}
/** Constructs a string reference from a ``std::basic_string`` object. */ /** Constructs a string reference from a ``std::basic_string`` object. */
template <typename Alloc> template <typename Traits, typename Alloc>
FMT_CONSTEXPR basic_string_view(const std::basic_string<Char, Alloc>& s) FMT_CONSTEXPR basic_string_view(
FMT_NOEXCEPT : data_(s.data()), const std::basic_string<Char, Traits, Alloc>& s) FMT_NOEXCEPT
size_(s.size()) {} : data_(s.data()),
size_(s.size()) {}
template < template <
typename S, typename S,
@ -389,10 +390,10 @@ inline basic_string_view<Char> to_string_view(const Char* s) {
return s; return s;
} }
template <typename Char, typename Traits, typename Allocator> template <typename Char, typename Traits, typename Alloc>
inline basic_string_view<Char> to_string_view( inline basic_string_view<Char> to_string_view(
const std::basic_string<Char, Traits, Allocator>& s) { const std::basic_string<Char, Traits, Alloc>& s) {
return {s.data(), s.size()}; return s;
} }
template <typename Char> template <typename Char>