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)
22 : container_(&container), it_(std::move(it)) {}
24 Iterator(
const Iterator& other);
25 Iterator(Iterator&& other)
noexcept;
26 Iterator& operator=(
const Iterator&);
27 Iterator& operator=(Iterator&&)
noexcept;
29 Iterator operator++(
int) {
31 return Iterator{*container_, it_++};
33 Iterator& operator++() {
38 reference operator*()
const {
42 pointer operator->()
const {
50 return it_.GetIteratorType();
54 auto GetName()
const {
return it_.GetName(); }
56 bool operator==(
const Iterator& other)
const {
return it_ == other.it_; }
57 bool operator!=(
const Iterator& other)
const {
return it_ != other.it_; }
60 void UpdateValue()
const;
64 const value_type* container_{
nullptr};
68 mutable std::optional<value_type> current_;