Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make is_range public API, fix #751 #759

Merged
merged 1 commit into from
Jun 6, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions include/fmt/ranges.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,6 @@ struct is_range_<T,typename std::conditional<
decltype(internal::declval<T>().end())>,
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.
template <typename T>
class is_tuple_like_ {
Expand All @@ -121,12 +115,6 @@ class is_tuple_like_ {
!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
#if defined(__cpp_lib_integer_sequence) || FMT_MSC_VER >= 1900
template <typename T, T... N>
Expand Down Expand Up @@ -176,9 +164,15 @@ void for_each(Tuple &&tup, F &&f) {
}
} // 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>
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:
// C++11 generic lambda for format()
template <typename FormatContext>
Expand Down Expand Up @@ -228,9 +222,15 @@ struct formatter<TupleT, Char,
}
};

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>
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;

Expand Down