If I understand the answer of "Why is comparing against "end()" iterator legal?" correctly, I can compare an end() iterator against a singular iterator. So we do it like here:
template <typename Iterator>
static bool isSingular(Iterator i) { return i == Iterator(); }
However, if this is called with an end() iterator I do get the following debug error (in a debug build -> map/set iterators incompatible). Is that error wrong, or is the code wrong and the error justified?
Win64 debug build error:
bool operator==(const _Tree_const_iterator& _Right) const
        {   // test for iterator equality
 #if _ITERATOR_DEBUG_LEVEL == 2
        if (this->_Getcont() != _Right._Getcont())
            {   // report error
            _DEBUG_ERROR("map/set iterators incompatible");
            }
