aboutsummaryrefslogtreecommitdiff
path: root/include/fmt/ranges.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/fmt/ranges.h')
-rw-r--r--include/fmt/ranges.h25
1 files changed, 16 insertions, 9 deletions
diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h
index c0b51aee..3638fffb 100644
--- a/include/fmt/ranges.h
+++ b/include/fmt/ranges.h
@@ -183,7 +183,7 @@ template <size_t N> using make_index_sequence = std::make_index_sequence<N>;
template <typename T, T... N> struct integer_sequence {
using value_type = T;
- static FMT_CONSTEXPR size_t size() { return sizeof...(N); }
+ static FMT_CONSTEXPR auto size() -> size_t { return sizeof...(N); }
};
template <size_t... N> using index_sequence = integer_sequence<size_t, N...>;
@@ -207,15 +207,15 @@ class is_tuple_formattable_ {
};
template <typename T, typename C> class is_tuple_formattable_<T, C, true> {
template <std::size_t... Is>
- static std::true_type check2(index_sequence<Is...>,
- integer_sequence<bool, (Is == Is)...>);
- static std::false_type check2(...);
+ static auto check2(index_sequence<Is...>,
+ integer_sequence<bool, (Is == Is)...>) -> std::true_type;
+ static auto check2(...) -> std::false_type;
template <std::size_t... Is>
- static decltype(check2(
+ static auto check(index_sequence<Is...>) -> decltype(check2(
index_sequence<Is...>{},
- integer_sequence<
- bool, (is_formattable<typename std::tuple_element<Is, T>::type,
- C>::value)...>{})) check(index_sequence<Is...>);
+ integer_sequence<bool,
+ (is_formattable<typename std::tuple_element<Is, T>::type,
+ C>::value)...>{}));
public:
static constexpr const bool value =
@@ -417,6 +417,12 @@ struct is_formattable_delayed
#endif
} // namespace detail
+template <typename...> struct conjunction : std::true_type {};
+template <typename P> struct conjunction<P> : P {};
+template <typename P1, typename... Pn>
+struct conjunction<P1, Pn...>
+ : conditional_t<bool(P1::value), conjunction<Pn...>, P1> {};
+
template <typename T, typename Char, typename Enable = void>
struct range_formatter;
@@ -482,7 +488,8 @@ struct range_formatter<
for (; it != end; ++it) {
if (i > 0) out = detail::copy_str<Char>(separator_, out);
ctx.advance_to(out);
- out = underlying_.format(mapper.map(*it), ctx);
+ auto&& item = *it;
+ out = underlying_.format(mapper.map(item), ctx);
++i;
}
out = detail::copy_str<Char>(closing_bracket_, out);