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

Using multiple computers for number crunching

c# multithreading wcf c#-4.0 multiprocessing

I'm currently running some computationally intensive simulations, but they are taking a long time to complete. I've already split the workload across all the available physical cores in my processor.

IOS: How to read specific data in one list of XML

ios xml parsing

When I use NSXMLParser to parse XML in iPhone app, I know how to do it in the scenario like this:

What's a reasonable amount of memory for a .NET application?

memory clr

I've had a couple of complaints that one of our managed apps is using 20-25Mb of RAM. I normally push back and say that memory's cheap; get over it.

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.