Skip to content

Commit

Permalink
Make iterator_proxy_value a forward_iterator (#4371) (#4372)
Browse files Browse the repository at this point in the history
* Make iteration_proxy_value model forward_iterator

* Amalgamate

* Suppress tidy warning
  • Loading branch information
captaincrutches authored Nov 15, 2024
1 parent 1825117 commit fde9a86
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions include/nlohmann/detail/iterators/iteration_proxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#pragma once

#include <cstddef> // size_t
#include <iterator> // input_iterator_tag
#include <iterator> // forward_iterator_tag
#include <string> // string, to_string
#include <tuple> // tuple_size, get, tuple_element
#include <utility> // move
Expand Down Expand Up @@ -40,7 +40,7 @@ template<typename IteratorType> class iteration_proxy_value
using value_type = iteration_proxy_value;
using pointer = value_type *;
using reference = value_type &;
using iterator_category = std::input_iterator_tag;
using iterator_category = std::forward_iterator_tag;
using string_type = typename std::remove_cv< typename std::remove_reference<decltype( std::declval<IteratorType>().key() ) >::type >::type;

private:
Expand Down
4 changes: 2 additions & 2 deletions single_include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5181,7 +5181,7 @@ NLOHMANN_JSON_NAMESPACE_END


#include <cstddef> // size_t
#include <iterator> // input_iterator_tag
#include <iterator> // forward_iterator_tag
#include <string> // string, to_string
#include <tuple> // tuple_size, get, tuple_element
#include <utility> // move
Expand Down Expand Up @@ -5215,7 +5215,7 @@ template<typename IteratorType> class iteration_proxy_value
using value_type = iteration_proxy_value;
using pointer = value_type *;
using reference = value_type &;
using iterator_category = std::input_iterator_tag;
using iterator_category = std::forward_iterator_tag;
using string_type = typename std::remove_cv< typename std::remove_reference<decltype( std::declval<IteratorType>().key() ) >::type >::type;

private:
Expand Down
2 changes: 1 addition & 1 deletion tests/src/unit-readme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ TEST_CASE("README" * doctest::skip())

// find an entry
CHECK(o.find("foo") != o.end());
if (o.find("foo") != o.end())
if (o.find("foo") != o.end()) // NOLINT(readability-container-contains)
{
// there is an entry with key "foo"
}
Expand Down

0 comments on commit fde9a86

Please sign in to comment.