mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-05 02:27:45 +00:00
Make is_range and is_tuple_like public API, fix #751
This commit is contained in:
parent
6322b47e60
commit
cd5b5670ba
@ -100,12 +100,6 @@ struct is_range_<T,typename std::conditional<
|
|||||||
decltype(internal::declval<T>().end())>,
|
decltype(internal::declval<T>().end())>,
|
||||||
void>::type> : std::true_type {};
|
void>::type> : std::true_type {};
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
struct is_range {
|
|
||||||
static FMT_CONSTEXPR_DECL const bool value =
|
|
||||||
is_range_<T>::value && !is_like_std_string<T>::value;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// tuple_size and tuple_element check.
|
/// tuple_size and tuple_element check.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class is_tuple_like_ {
|
class is_tuple_like_ {
|
||||||
@ -121,12 +115,6 @@ class is_tuple_like_ {
|
|||||||
!std::is_void<decltype(check<T>(FMT_NULL))>::value;
|
!std::is_void<decltype(check<T>(FMT_NULL))>::value;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
struct is_tuple_like {
|
|
||||||
static FMT_CONSTEXPR_DECL const bool value =
|
|
||||||
is_tuple_like_<T>::value && !is_range_<T>::value;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Check for integer_sequence
|
// Check for integer_sequence
|
||||||
#if defined(__cpp_lib_integer_sequence) || FMT_MSC_VER >= 1900
|
#if defined(__cpp_lib_integer_sequence) || FMT_MSC_VER >= 1900
|
||||||
template <typename T, T... N>
|
template <typename T, T... N>
|
||||||
@ -176,9 +164,15 @@ void for_each(Tuple &&tup, F &&f) {
|
|||||||
}
|
}
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
struct is_tuple_like {
|
||||||
|
static FMT_CONSTEXPR_DECL const bool value =
|
||||||
|
internal::is_tuple_like_<T>::value && !internal::is_range_<T>::value;
|
||||||
|
};
|
||||||
|
|
||||||
template <typename TupleT, typename Char>
|
template <typename TupleT, typename Char>
|
||||||
struct formatter<TupleT, Char,
|
struct formatter<TupleT, Char,
|
||||||
typename std::enable_if<internal::is_tuple_like<TupleT>::value>::type> {
|
typename std::enable_if<fmt::is_tuple_like<TupleT>::value>::type> {
|
||||||
private:
|
private:
|
||||||
// C++11 generic lambda for format()
|
// C++11 generic lambda for format()
|
||||||
template <typename FormatContext>
|
template <typename FormatContext>
|
||||||
@ -228,9 +222,15 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
struct is_range {
|
||||||
|
static FMT_CONSTEXPR_DECL const bool value =
|
||||||
|
internal::is_range_<T>::value && !internal::is_like_std_string<T>::value;
|
||||||
|
};
|
||||||
|
|
||||||
template <typename RangeT, typename Char>
|
template <typename RangeT, typename Char>
|
||||||
struct formatter<RangeT, Char,
|
struct formatter<RangeT, Char,
|
||||||
typename std::enable_if<internal::is_range<RangeT>::value>::type> {
|
typename std::enable_if<fmt::is_range<RangeT>::value>::type> {
|
||||||
|
|
||||||
formatting_range<Char> formatting;
|
formatting_range<Char> formatting;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user