diff --git a/include/fmt/format.h b/include/fmt/format.h index 0f10e5e9..c7ed6cc3 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2506,18 +2506,21 @@ template <> struct formatter { } }; -template -struct arg_join : detail::view { +template +struct join_view : detail::view { It begin; Sentinel end; basic_string_view sep; - arg_join(It b, Sentinel e, basic_string_view s) + join_view(It b, Sentinel e, basic_string_view s) : begin(b), end(e), sep(s) {} }; template -struct formatter, Char> { +using arg_join FMT_DEPRECATED_ALIAS = join_view; + +template +struct formatter, Char> { private: using value_type = typename std::iterator_traits::value_type; using context = buffer_context; @@ -2548,7 +2551,7 @@ struct formatter, Char> { } template - auto format(const arg_join& value, FormatContext& ctx) + auto format(const join_view& value, FormatContext& ctx) -> decltype(ctx.out()) { auto it = value.begin; auto out = ctx.out(); @@ -2569,7 +2572,7 @@ struct formatter, Char> { elements separated by `sep`. */ template -arg_join join(It begin, Sentinel end, string_view sep) { +auto join(It begin, Sentinel end, string_view sep) -> join_view { return {begin, end, sep}; } @@ -2590,8 +2593,8 @@ arg_join join(It begin, Sentinel end, string_view sep) { \endrst */ template -arg_join, detail::sentinel_t, char> join( - Range&& range, string_view sep) { +auto join(Range&& range, string_view sep) + -> join_view, detail::sentinel_t> { return join(std::begin(range), std::end(range), sep); } diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index e9f24ff8..5e19ac6b 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -296,8 +296,8 @@ struct formatter::value>> { } formatting_tuple& formatting; size_t& i; - typename std::add_lvalue_reference().out())>::type out; + typename std::add_lvalue_reference< + decltype(std::declval().out())>::type out; }; public: @@ -452,8 +452,8 @@ FMT_CONSTEXPR tuple_arg_join join( \endrst */ template -arg_join join(std::initializer_list list, - string_view sep) { +join_view join(std::initializer_list list, + string_view sep) { return join(std::begin(list), std::end(list), sep); } diff --git a/include/fmt/wchar.h b/include/fmt/wchar.h index d3987976..cb669588 100644 --- a/include/fmt/wchar.h +++ b/include/fmt/wchar.h @@ -54,19 +54,21 @@ constexpr detail::udl_arg operator"" _a(const wchar_t* s, size_t) { } // namespace literals template -arg_join join(It begin, Sentinel end, wstring_view sep) { +auto join(It begin, Sentinel end, wstring_view sep) + -> join_view { return {begin, end, sep}; } template -arg_join, detail::sentinel_t, wchar_t> join( - Range&& range, wstring_view sep) { +auto join(Range&& range, wstring_view sep) + -> join_view, detail::sentinel_t, + wchar_t> { return join(std::begin(range), std::end(range), sep); } template -arg_join join(std::initializer_list list, - wstring_view sep) { +auto join(std::initializer_list list, wstring_view sep) + -> join_view { return join(std::begin(list), std::end(list), sep); }