8 #include <nlohmann/detail/meta/type_traits.hpp>
9 #include <nlohmann/detail/value_t.hpp>
15 template<
typename string_type>
16 void int_to_string( string_type& target, std::size_t value )
18 target = std::to_string(value);
23 using difference_type = std::ptrdiff_t;
27 using iterator_category = std::input_iterator_tag;
28 using string_type =
typename std::remove_cv< typename std::remove_reference<decltype( std::declval<IteratorType>().
key() ) >::type >::type;
34 std::size_t array_index = 0;
36 mutable std::size_t array_index_last = 0;
38 mutable string_type array_index_str =
"0";
40 const string_type empty_str =
"";
63 return anchor == o.anchor;
69 return anchor != o.anchor;
73 const string_type&
key()
const
75 assert(anchor.m_object !=
nullptr);
77 switch (anchor.m_object->type())
82 if (array_index != array_index_last)
84 int_to_string( array_index_str, array_index );
85 array_index_last = array_index;
87 return array_index_str;
101 typename IteratorType::reference
value()
const
103 return anchor.value();
112 typename IteratorType::reference container;
134 template <std::
size_t N,
typename IteratorType, enable_if_t<N == 0,
int> = 0>
142 template <std::
size_t N,
typename IteratorType, enable_if_t<N == 1,
int> = 0>
156 #if defined(__clang__)
158 #pragma clang diagnostic push
159 #pragma clang diagnostic ignored "-Wmismatched-tags"
161 template <
typename IteratorType>
163 :
public std::integral_constant<std::size_t, 2> {};
165 template <std::
size_t N,
typename IteratorType>
169 using type = decltype(
170 get<N>(std::declval <
173 #if defined(__clang__)
174 #pragma clang diagnostic pop
iteration_proxy_value< IteratorType > begin() noexcept
return iterator begin (needed for range-based for)
Definition: iteration_proxy.hpp:120
IteratorType::reference value() const
return value of the iterator
Definition: iteration_proxy.hpp:101
@ object
object (unordered set of name/value pairs)
namespace for Niels Lohmann
Definition: adl_serializer.hpp:9
iteration_proxy_value & operator*()
dereference operator (needed for range-based for)
Definition: iteration_proxy.hpp:46
const string_type & key() const
return key of the iterator
Definition: iteration_proxy.hpp:73
iteration_proxy_value< IteratorType > end() noexcept
return iterator end (needed for range-based for)
Definition: iteration_proxy.hpp:126
@ array
array (ordered collection of values)
iteration_proxy_value & operator++()
increment operator (needed for range-based for)
Definition: iteration_proxy.hpp:52
Definition: iteration_proxy.hpp:21
iteration_proxy(typename IteratorType::reference cont) noexcept
construct iteration proxy from a container
Definition: iteration_proxy.hpp:116
bool operator!=(const iteration_proxy_value &o) const
inequality operator (needed for range-based for)
Definition: iteration_proxy.hpp:67
bool operator==(const iteration_proxy_value &o) const
equality operator (needed for InputIterator)
Definition: iteration_proxy.hpp:61
proxy class for the items() function
Definition: iteration_proxy.hpp:109