arg_join -> join_view
This commit is contained in:
parent
a9a9018191
commit
0901176fe4
@ -2506,18 +2506,21 @@ template <> struct formatter<bytes> {
|
||||
}
|
||||
};
|
||||
|
||||
template <typename It, typename Sentinel, typename Char>
|
||||
struct arg_join : detail::view {
|
||||
template <typename It, typename Sentinel, typename Char = char>
|
||||
struct join_view : detail::view {
|
||||
It begin;
|
||||
Sentinel end;
|
||||
basic_string_view<Char> sep;
|
||||
|
||||
arg_join(It b, Sentinel e, basic_string_view<Char> s)
|
||||
join_view(It b, Sentinel e, basic_string_view<Char> s)
|
||||
: begin(b), end(e), sep(s) {}
|
||||
};
|
||||
|
||||
template <typename It, typename Sentinel, typename Char>
|
||||
struct formatter<arg_join<It, Sentinel, Char>, Char> {
|
||||
using arg_join FMT_DEPRECATED_ALIAS = join_view<It, Sentinel, Char>;
|
||||
|
||||
template <typename It, typename Sentinel, typename Char>
|
||||
struct formatter<join_view<It, Sentinel, Char>, Char> {
|
||||
private:
|
||||
using value_type = typename std::iterator_traits<It>::value_type;
|
||||
using context = buffer_context<Char>;
|
||||
@ -2548,7 +2551,7 @@ struct formatter<arg_join<It, Sentinel, Char>, Char> {
|
||||
}
|
||||
|
||||
template <typename FormatContext>
|
||||
auto format(const arg_join<It, Sentinel, Char>& value, FormatContext& ctx)
|
||||
auto format(const join_view<It, Sentinel, Char>& value, FormatContext& ctx)
|
||||
-> decltype(ctx.out()) {
|
||||
auto it = value.begin;
|
||||
auto out = ctx.out();
|
||||
@ -2569,7 +2572,7 @@ struct formatter<arg_join<It, Sentinel, Char>, Char> {
|
||||
elements separated by `sep`.
|
||||
*/
|
||||
template <typename It, typename Sentinel>
|
||||
arg_join<It, Sentinel, char> join(It begin, Sentinel end, string_view sep) {
|
||||
auto join(It begin, Sentinel end, string_view sep) -> join_view<It, Sentinel> {
|
||||
return {begin, end, sep};
|
||||
}
|
||||
|
||||
@ -2590,8 +2593,8 @@ arg_join<It, Sentinel, char> join(It begin, Sentinel end, string_view sep) {
|
||||
\endrst
|
||||
*/
|
||||
template <typename Range>
|
||||
arg_join<detail::iterator_t<Range>, detail::sentinel_t<Range>, char> join(
|
||||
Range&& range, string_view sep) {
|
||||
auto join(Range&& range, string_view sep)
|
||||
-> join_view<detail::iterator_t<Range>, detail::sentinel_t<Range>> {
|
||||
return join(std::begin(range), std::end(range), sep);
|
||||
}
|
||||
|
||||
|
@ -296,8 +296,8 @@ struct formatter<TupleT, Char, enable_if_t<fmt::is_tuple_like<TupleT>::value>> {
|
||||
}
|
||||
formatting_tuple<Char>& formatting;
|
||||
size_t& i;
|
||||
typename std::add_lvalue_reference<decltype(
|
||||
std::declval<FormatContext>().out())>::type out;
|
||||
typename std::add_lvalue_reference<
|
||||
decltype(std::declval<FormatContext>().out())>::type out;
|
||||
};
|
||||
|
||||
public:
|
||||
@ -452,7 +452,7 @@ FMT_CONSTEXPR tuple_arg_join<wchar_t, T...> join(
|
||||
\endrst
|
||||
*/
|
||||
template <typename T>
|
||||
arg_join<const T*, const T*, char> join(std::initializer_list<T> list,
|
||||
join_view<const T*, const T*> join(std::initializer_list<T> list,
|
||||
string_view sep) {
|
||||
return join(std::begin(list), std::end(list), sep);
|
||||
}
|
||||
|
@ -54,19 +54,21 @@ constexpr detail::udl_arg<wchar_t> operator"" _a(const wchar_t* s, size_t) {
|
||||
} // namespace literals
|
||||
|
||||
template <typename It, typename Sentinel>
|
||||
arg_join<It, Sentinel, wchar_t> join(It begin, Sentinel end, wstring_view sep) {
|
||||
auto join(It begin, Sentinel end, wstring_view sep)
|
||||
-> join_view<It, Sentinel, wchar_t> {
|
||||
return {begin, end, sep};
|
||||
}
|
||||
|
||||
template <typename Range>
|
||||
arg_join<detail::iterator_t<Range>, detail::sentinel_t<Range>, wchar_t> join(
|
||||
Range&& range, wstring_view sep) {
|
||||
auto join(Range&& range, wstring_view sep)
|
||||
-> join_view<detail::iterator_t<Range>, detail::sentinel_t<Range>,
|
||||
wchar_t> {
|
||||
return join(std::begin(range), std::end(range), sep);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
arg_join<const T*, const T*, wchar_t> join(std::initializer_list<T> list,
|
||||
wstring_view sep) {
|
||||
auto join(std::initializer_list<T> list, wstring_view sep)
|
||||
-> join_view<const T*, const T*, wchar_t> {
|
||||
return join(std::begin(list), std::end(list), sep);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user