From f1080d7c396d692067384257f87c9feee98a6a98 Mon Sep 17 00:00:00 2001 From: David Avedissian Date: Tue, 18 Dec 2018 20:44:37 +0000 Subject: [PATCH] Code review. --- .../nlohmann/detail/iterators/iterator_traits.hpp | 12 ++++++------ single_include/nlohmann/json.hpp | 15 ++++++++------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/include/nlohmann/detail/iterators/iterator_traits.hpp b/include/nlohmann/detail/iterators/iterator_traits.hpp index 607dd49a..35ea81fb 100644 --- a/include/nlohmann/detail/iterators/iterator_traits.hpp +++ b/include/nlohmann/detail/iterators/iterator_traits.hpp @@ -39,11 +39,11 @@ struct iterator_traits::value>> template struct iterator_traits::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&; }; } -} \ No newline at end of file +} diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 24ff17b8..2d7e1ddd 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -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 struct iterator_traits { @@ -383,14 +383,15 @@ struct iterator_traits < T, enable_if_t < !std::is_pointer::value >> template struct iterator_traits::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 // #include