Document a more useful to_string_view overload

This commit is contained in:
Victor Zverovich 2019-06-03 11:57:08 -07:00
parent 1e6e87cb74
commit 7e42c65bb6
2 changed files with 6 additions and 6 deletions

View File

@ -210,7 +210,7 @@ Utilities
.. doxygenfunction:: fmt::to_wstring(const T&) .. doxygenfunction:: fmt::to_wstring(const T&)
.. doxygenfunction:: fmt::to_string_view(const basic_string<Char, Traits, Allocator>&) .. doxygenfunction:: fmt::to_string_view(const Char*)
.. doxygenfunction:: fmt::join(const Range&, string_view) .. doxygenfunction:: fmt::join(const Range&, string_view)

View File

@ -461,6 +461,11 @@ template <typename T> struct is_char : std::is_integral<T> {};
std::string message = fmt::format(my_string("The answer is {}"), 42); std::string message = fmt::format(my_string("The answer is {}"), 42);
\endrst \endrst
*/ */
template <typename Char, FMT_ENABLE_IF(is_char<Char>::value)>
inline basic_string_view<Char> to_string_view(const Char* s) {
return s;
}
template <typename Char, typename Traits, typename Allocator> template <typename Char, typename Traits, typename Allocator>
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, Allocator>& s) {
@ -472,11 +477,6 @@ inline basic_string_view<Char> to_string_view(basic_string_view<Char> s) {
return s; return s;
} }
template <typename Char, FMT_ENABLE_IF(is_char<Char>::value)>
inline basic_string_view<Char> to_string_view(const Char* s) {
return s;
}
template <typename Char, template <typename Char,
FMT_ENABLE_IF(!std::is_empty<internal::std_string_view<Char>>::value)> FMT_ENABLE_IF(!std::is_empty<internal::std_string_view<Char>>::value)>
inline basic_string_view<Char> to_string_view( inline basic_string_view<Char> to_string_view(