5#include <userver/formats/yaml/value.hpp>
11template <
typename iter_traits>
14 using YamlIterator = formats::
yaml::Value::const_iterator;
15 using iterator_category = std::forward_iterator_tag;
16 using difference_type = std::ptrdiff_t;
17 using value_type =
typename iter_traits::value_type;
18 using reference =
typename iter_traits::reference;
19 using pointer =
typename iter_traits::pointer;
21 Iterator(
const value_type& container, YamlIterator it) : container_(&container), it_(std::move(it)) {}
23 Iterator(
const Iterator& other);
24 Iterator(Iterator&& other)
noexcept;
25 Iterator& operator=(
const Iterator&);
26 Iterator& operator=(Iterator&&)
noexcept;
28 Iterator operator++(
int);
29 Iterator& operator++();
31 reference operator*()
const {
35 pointer operator->()
const {
45 std::string GetName()
const;
47 bool operator==(
const Iterator& other)
const {
return it_ == other.it_; }
48 bool operator!=(
const Iterator& other)
const {
return it_ != other.it_; }
51 void UpdateValue()
const;
52 void IncrementInternalIterator();
56 const value_type* container_{
nullptr};
60 mutable std::optional<value_type> current_;