string iterators are incompatible

Here is my sample code ..

    const std::string strSchemeEnd("://");

    StringConstIteratorType itScheme = std::search(p_strUrl.begin(), p_strUrl.end(), strSchemeEnd.begin(), strSchemeEnd.end());
    StringConstIteratorType  l_itTempConst = p_strUrl.begin();
    m_strScheme.reserve(std::distance(l_itTempConst, itScheme));
    std::copy(l_itTempConst , itScheme, std::back_inserter(m_strScheme));
    l_itTempConst = strSchemeEnd.end();
    if ( itScheme == l_itTempConst )

When I try to run the program, I find the following errors

    void _Compat(const _Myiter& _Right) const
        {   // test for compatible iterator pair
        if (this->_Getcont() == 0
            || this->_Getcont() != _Right._Getcont())
            {   // report error
            _DEBUG_ERROR("string iterators incompatible");

I face this problem a lot. Sometimes a workaround works and sometimes it doesn't. I want to know the cause of this "string iterators incompatible" error. Can somebody help me ?


The problem in this case is that itScheme is an iterator pointing to p_strUrl and l_itTempConst is an iterator pointing to strSchemeEnd. Because they are pointing at different strings it is not legal to compare these two iterators.

Need Your Help

Release a WPF app with local database

c# wpf database

OK, so I am quite lost. This is my first real application written for windows with a local database.

Port sharing in net tcp binding service wcf wcf-binding wcf-client nettcpbinding

I have a site which uses nettcp binding service which is opened at port Number 808.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.