diff --git a/include/fmt/base.h b/include/fmt/base.h index 0dc6ce06..bf78f713 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -2125,6 +2125,7 @@ template struct type_is_unformattable_for; template struct string_value { const Char* data; size_t size; + auto str() const -> basic_string_view { return {data, size}; } }; template struct named_arg_value { @@ -2542,10 +2543,8 @@ template class basic_format_arg { case detail::type::double_type: return vis(value_.double_value); case detail::type::long_double_type: return vis(value_.long_double_value); case detail::type::cstring_type: return vis(value_.string.data); - case detail::type::string_type: - using sv = basic_string_view; - return vis(sv(value_.string.data, value_.string.size)); - case detail::type::pointer_type: return vis(value_.pointer); + case detail::type::string_type: return vis(value_.string.str()); + case detail::type::pointer_type: return vis(value_.pointer); case detail::type::custom_type: return vis(typename basic_format_arg::handle(value_.custom)); } diff --git a/include/fmt/format.h b/include/fmt/format.h index a6cafc01..ad66aeb2 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -534,11 +534,6 @@ FMT_INLINE void assume(bool condition) { #endif } -// An approximation of iterator_t for pre-C++20 systems. -template -using iterator_t = decltype(std::begin(std::declval())); -template using sentinel_t = decltype(std::end(std::declval())); - // A workaround for std::string not having mutable data() until C++17. template inline auto get_data(std::basic_string& s) -> Char* { diff --git a/include/fmt/xchar.h b/include/fmt/xchar.h index 3d928a45..51c11255 100644 --- a/include/fmt/xchar.h +++ b/include/fmt/xchar.h @@ -144,7 +144,7 @@ auto join(It begin, Sentinel end, wstring_view sep) template auto join(Range&& range, wstring_view sep) - -> join_view, detail::sentinel_t, + -> join_view { return join(std::begin(range), std::end(range), sep); }