Writing two nearly identical iterator classes is duplication, so containers use one template with a bool parameter — std::deque does the same. The converting constructor is the subtle part: iterator must convert to const_iterator (callers expect it), but if the same constructor also works backwards, anyone holding a const_iterator can write through the container.
The container has one iterator template for both cases: Iter<false> is mutable, Iter<true> is const. The converting constructor currently allows conversion in BOTH directions — const_iterator silently becomes iterator, and const protection is gone. Constrain it: non-const → const converts, the reverse must not compile.
iterator → const_iterator conversion worksconst_iterator → iterator must NOT compileiteratorWrite the truth table: false->true allowed, false->false allowed, true->true allowed, true->false forbidden. One boolean expression covers it.
Attach the condition as a default template argument: template <bool OtherIsConst, class = std::enable_if_t<...>>.
Hit Submit (or ⌘/Ctrl + ↵) — test results will show up here.