#include <iostream>
#include <map>
#include <type_traits>
using namespace std;

// Stub
struct Tree_ {};

template<typename Key, typename mapped_type>
struct mp {
class const_iterator
{
public:
    typedef const_iterator self_type;
    // HTRD: тут const как раз не нужен
    typedef /*const*/ std::pair<Key, mapped_type> value_type;
    typedef const value_type& reference;
    typedef const value_type* pointer;
    typedef std::forward_iterator_tag iterator_category;
    typedef int difference_type;
    //constructors
        const_iterator()
        {
            curr = nullptr;
            currPair = new value_type;
            printf("111\n");
        }
        const_iterator(Tree_ &n)
        {
#if 0
            printf("2");
            curr = &n;
            currPair = new value_type;
            *currPair = std::make_pair(curr->key, curr->getValue());
#endif
        }
        const_iterator(const self_type& other)
        {
#if 0
            curr = other.curr;
            currPair = new value_type;
            *currPair = *other.currPair;
#endif
        }
        const_iterator(const std::pair<Key, mapped_type>& other)
        {
#if 0
            curr = other.curr;
            currPair = other.currPair;
#endif
        }
    //operators
        //prefix increment
        self_type& operator++() {
#if 0
            //сравни старое значение и новое
            if (currPair->second != curr->getValue())
                curr->setValue(currPair->second);
            curr = successor(); // point to next node
            if (curr)
                *currPair = std::make_pair(curr->key, curr->getValue());
#endif
            return *this;
        }
        // postfix increment (it++)
        self_type operator++(int)
        {
            self_type old = *this;
            ++(*this);
            return old;
        }
        //reference
        // HTRD: тут const не нужен уже, т.к. к типам добавили
        reference operator*() const {
            return *currPair;
        }
        //pointer
        // HTRD: тут const не нужен уже, т.к. к типам добавили
        const pointer operator->() const // HTRD: тут забыли добавить const
        {
            return currPair;
        }
        // Inequality test operator
        bool operator!=(self_type const & other) const {
            return this->curr != other.curr;
        }
        // Dereference operator 
        bool operator==(self_type const & other) const {
            return this->curr == other.curr;
        }

	// HTRD: а это так надо? вы const_iterator готовы кастовать к iterator?
    //operator iterator() const { return iterator(); }
private:
    pointer currPair;
    Tree_* curr;
    //Successor
    Tree_* successor()
    {
#if 0
        if (curr)
            if (curr->right != 0) {
                curr = curr->right;
                while (curr->left != 0)
                    curr = curr->left;
            }
            else {
                Tree_* y = curr->parent;
                if (y == nullptr)
                    return nullptr;
                while (curr == y->right) {
                    curr = y;
                    y = y->parent;
                    if (y == nullptr)
                        return nullptr;
                }
                if (curr->right != y)
                    curr = y;
            }
            return curr;
#endif
    }
}; // iterator
}; // mp

int main() 
{
	using MapIt = mp<int,int>::const_iterator;
	MapIt tmp1;
	static_assert(std::is_const<typename std::remove_reference<decltype(*tmp1)>::type>::value, "returned value by dereferencing iterator is not const");

	// your code goes here
	return 0;
}