#pragma once #include #include namespace jvalidate::adapter::detail { /** * @brief An iterator for binding JSON values of type Array - which are * congruent to a vector. * * @tparam It The underlying iterator type being operated on * @tparam Adapter The owning adapter type, must fulfill the following * contracts: * - is constructible from the value_type of It * Additionally, Adapter is expected to conform to the jvalidate::Adapter * concept. */ template class JsonArrayIterator : public It { public: using value_type = Adapter; using reference = Adapter; using pointer = ::jvalidate::detail::DerefProxy; using difference_type = std::ptrdiff_t; using iterator_category = std::forward_iterator_tag; JsonArrayIterator() = default; // Sentinel for handling null objects JsonArrayIterator(It it) : It(it) {} reference operator*() const { return Adapter(It::operator*()); } pointer operator->() const { return {operator*()}; } JsonArrayIterator operator++(int) { auto tmp = *this; ++*this; return tmp; } JsonArrayIterator & operator++() { It::operator++(); return *this; } }; }