From 221e1acfe1f635d25053315a8edbaadbb3b3b858 Mon Sep 17 00:00:00 2001 From: Justin Riddell Date: Thu, 14 Nov 2024 21:24:42 +0000 Subject: [PATCH] Export all range join overloads --- include/fmt/ranges.h | 56 ++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index ee3b747c475c..fe40fa851d35 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -676,34 +676,6 @@ struct formatter, Char> { } }; -/// Returns a view that formats the iterator range `[begin, end)` with elements -/// separated by `sep`. -template -auto join(It begin, Sentinel end, string_view sep) -> join_view { - return {std::move(begin), end, sep}; -} - -/** - * Returns a view that formats `range` with elements separated by `sep`. - * - * **Example**: - * - * auto v = std::vector{1, 2, 3}; - * fmt::print("{}", fmt::join(v, ", ")); - * // Output: 1, 2, 3 - * - * `fmt::join` applies passed format specifiers to the range elements: - * - * fmt::print("{:02}", fmt::join(v, ", ")); - * // Output: 01, 02, 03 - */ -template ::value)> -auto join(Range&& r, string_view sep) - -> join_view { - return {detail::range_begin(r), detail::range_end(r), sep}; -} - template struct tuple_join_view : detail::view { const Tuple& tuple; basic_string_view sep; @@ -820,6 +792,34 @@ struct formatter< FMT_BEGIN_EXPORT +/// Returns a view that formats the iterator range `[begin, end)` with elements +/// separated by `sep`. +template +auto join(It begin, Sentinel end, string_view sep) -> join_view { + return {std::move(begin), end, sep}; +} + +/** + * Returns a view that formats `range` with elements separated by `sep`. + * + * **Example**: + * + * auto v = std::vector{1, 2, 3}; + * fmt::print("{}", fmt::join(v, ", ")); + * // Output: 1, 2, 3 + * + * `fmt::join` applies passed format specifiers to the range elements: + * + * fmt::print("{:02}", fmt::join(v, ", ")); + * // Output: 01, 02, 03 + */ +template ::value)> +auto join(Range&& r, string_view sep) + -> join_view { + return {detail::range_begin(r), detail::range_end(r), sep}; +} + /** * Returns an object that formats `std::tuple` with elements separated by `sep`. *