mirror of
https://github.com/nlohmann/json
synced 2024-11-22 20:10:06 +00:00
Code review.
This commit is contained in:
parent
2c23f0a346
commit
f1080d7c39
@ -39,11 +39,11 @@ struct iterator_traits<T, enable_if_t<!std::is_pointer<T>::value>>
|
||||
|
||||
template <typename T>
|
||||
struct iterator_traits<T*, enable_if_t<std::is_object<T>::value>> {
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
typedef T value_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T* pointer;
|
||||
typedef T& reference;
|
||||
using iterator_category = std::random_access_iterator_tag;
|
||||
using value_type = T;
|
||||
using difference_type = ptrdiff_t;
|
||||
using pointer = T*;
|
||||
using reference = T&;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -367,8 +367,8 @@ struct iterator_types <
|
||||
using iterator_category = typename It::iterator_category;
|
||||
};
|
||||
|
||||
// This is required due to https://github.com/nlohmann/json/issues/1341 - where some
|
||||
// compilers implement std::iterator_traits in a way that doesn't work with SFINAE.
|
||||
// This is required as some compilers implement std::iterator_traits in a way that
|
||||
// doesn't work with SFINAE. See https://github.com/nlohmann/json/issues/1341.
|
||||
template <typename T, typename = void>
|
||||
struct iterator_traits
|
||||
{
|
||||
@ -383,14 +383,15 @@ struct iterator_traits < T, enable_if_t < !std::is_pointer<T>::value >>
|
||||
template <typename T>
|
||||
struct iterator_traits<T*, enable_if_t<std::is_object<T>::value>>
|
||||
{
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
typedef T value_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T* pointer;
|
||||
typedef T& reference;
|
||||
using iterator_category = std::random_access_iterator_tag;
|
||||
using value_type = T;
|
||||
using difference_type = ptrdiff_t;
|
||||
using pointer = T*;
|
||||
using reference = T&;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// #include <nlohmann/detail/meta/cpp_future.hpp>
|
||||
|
||||
// #include <nlohmann/detail/meta/detected.hpp>
|
||||
|
Loading…
Reference in New Issue
Block a user