#pragma once #include #include namespace iterator { template class Proxy : public Facade { public: static constexpr bool single_pass_iterator = true; private: It impl_; public: Proxy() = default; Proxy(It impl) : impl_(impl) {} template Proxy(Args &&... args) : impl_(std::forward(args)...) {} decltype(auto) dereference() const { return *impl_; } void increment() { ++impl_; } bool equal_to(Self const & other) const { return impl_ == other.impl_; } bool at_end() const requires(has_sentinel) { return impl() == typename It::sentinel_type(); } protected: auto impl() const { return impl_; } }; template class Proxy : public Facade { private: It impl_; public: Proxy() = default; Proxy(It impl) : impl_(impl) {} template Proxy(Args &&... args) : impl_(std::forward(args)...) {} decltype(auto) dereference() const { return *impl_; } void increment() { ++impl_; } bool equal_to(Self const & other) const { return impl_ == other.impl_; } bool at_end() const requires(has_sentinel) { return impl() == typename It::sentinel_type(); } protected: auto impl() const { return impl_; } }; template class Proxy : public Facade { private: It impl_; public: Proxy() = default; Proxy(It impl) : impl_(impl) {} template Proxy(Args &&... args) : impl_(std::forward(args)...) {} decltype(auto) dereference() const { return *impl_; } void increment() { ++impl_; } void decrement() { --impl_; } bool equal_to(Self const & other) const { return impl_ == other.impl_; } bool at_end() const requires(has_sentinel) { return impl() == typename It::sentinel_type(); } protected: auto impl() const { return impl_; } }; template class Proxy : public Facade { public: using difference_type = typename std::iterator_traits::difference_type; private: It impl_; public: Proxy() = default; Proxy(It impl) : impl_(impl) {} template Proxy(Args &&... args) : impl_(std::forward(args)...) {} decltype(auto) dereference() const { return *impl_; } void advance(difference_type off) { impl_ += off; } bool equal_to(Self const & other) const { return impl_ == other.impl_; } difference_type distance_to(Self const & other) const { return other.impl_ - impl_; } friend auto operator-(sentinel_for auto sentinel, Self const & self) { return sentinel - self.impl(); } bool at_end() const requires(has_sentinel) { return (typename It::sentinel_type() - impl()) <= 0; } protected: auto impl() const { return impl_; } }; }