mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-24 21:16:56 +00:00
Correct basic_string_view from string ctor
This commit is contained in:
parent
1f918159ed
commit
0d6dd0cc6a
@ -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>
|
||||||
|
Loading…
Reference in New Issue
Block a user