| 812 | } |
| 813 | |
| 814 | class TDoubleIterator { |
| 815 | public: |
| 816 | using iterator_category = std::input_iterator_tag; |
| 817 | using value_type = int; |
| 818 | using pointer = void; |
| 819 | using reference = int; |
| 820 | using const_reference = int; |
| 821 | using difference_type = ptrdiff_t; |
| 822 | |
| 823 | TDoubleIterator() = default; |
| 824 | |
| 825 | TDoubleIterator(const char* ptr) |
| 826 | : Ptr_(ptr) |
| 827 | { |
| 828 | } |
| 829 | |
| 830 | TDoubleIterator operator++() { |
| 831 | Ptr_ += 2; |
| 832 | return *this; |
| 833 | } |
| 834 | |
| 835 | TDoubleIterator operator++(int) { |
| 836 | TDoubleIterator tmp = *this; |
| 837 | ++*this; |
| 838 | return tmp; |
| 839 | } |
| 840 | |
| 841 | friend bool operator==(TDoubleIterator l, TDoubleIterator r) { |
| 842 | return l.Ptr_ == r.Ptr_; |
| 843 | } |
| 844 | |
| 845 | friend bool operator!=(TDoubleIterator l, TDoubleIterator r) { |
| 846 | return l.Ptr_ != r.Ptr_; |
| 847 | } |
| 848 | |
| 849 | int operator*() const { |
| 850 | return (*Ptr_ - '0') * 10 + *(Ptr_ + 1) - '0'; |
| 851 | } |
| 852 | |
| 853 | private: |
| 854 | const char* Ptr_ = nullptr; |
| 855 | }; |
| 856 | |
| 857 | Y_UNIT_TEST(TestInputIterator) { |
| 858 | const char* beg = "1213002233000011"; |