mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-19 20:18:49 +00:00
Remove iterator_category
This commit is contained in:
parent
27fdb4ead2
commit
2a3f4de3f4
@ -1352,32 +1352,16 @@ namespace detail {
|
||||
|
||||
// A workaround for gcc 4.8 to make void_t work in a SFINAE context.
|
||||
template <typename... Ts> struct void_t_impl { using type = void; };
|
||||
|
||||
template <typename... Ts>
|
||||
using void_t = typename detail::void_t_impl<Ts...>::type;
|
||||
|
||||
// Detect the iterator category of *any* given type in a SFINAE-friendly way.
|
||||
// Unfortunately, older implementations of std::iterator_traits are not safe
|
||||
// for use in a SFINAE-context.
|
||||
template <typename It, typename Enable = void>
|
||||
struct iterator_category : std::false_type {};
|
||||
|
||||
template <typename T> struct iterator_category<T*> {
|
||||
using type = std::random_access_iterator_tag;
|
||||
};
|
||||
|
||||
template <typename It>
|
||||
struct iterator_category<It, void_t<typename It::iterator_category>> {
|
||||
using type = typename It::iterator_category;
|
||||
};
|
||||
|
||||
template <typename It, typename T, typename Enable = void>
|
||||
struct is_output_iterator : std::false_type {};
|
||||
|
||||
template <typename It, typename T>
|
||||
struct is_output_iterator<
|
||||
It, T,
|
||||
void_t<typename iterator_category<It>::type,
|
||||
void_t<typename std::iterator_traits<It>::iterator_category,
|
||||
decltype(*std::declval<It>() = std::declval<T>())>>
|
||||
: std::true_type {};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user