Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C++
std::vector<CParserOutNode> m_Param;
int ret = parser->Parse(bbuf,&m_Param,(char*)commandname.c_str(),&TestType);
if(ret==0)
{
    std::vector<CParserOutNode>::iterator iter;
    iter = m_Param.begin();
    while (iter != m_Param.end())  // program stop
    {
        // do code
    }
}

exit with code Vector Iterators Incompatible
Posted
Updated 13-Sep-14 23:21pm
v4
Comments
George Jonsson 14-Sep-14 4:31am    
So what is your problem?
You need to describe where it fails and what kind of error you get.
Mahmoud_Gamal 14-Sep-14 4:51am    
it return vector iterator incompatiable and program stop at comment //program stop
George Jonsson 14-Sep-14 5:12am    
If this is your real code it will not even compile.
Change while (iter != m_param.end())
to while (iter != m_Param.end())
Mahmoud_Gamal 14-Sep-14 5:19am    
it already like that i will change it now in post sorry

1 solution

Try to change the code like this. Change template class to be a pointer CParserOutNode*
Not sure what the method parser->Parse is doing, though.
C++
std::vector<CParserOutNode*> m_Param;
int ret = parser->Parse(bbuf, &m_Param, (char*)commandname.c_str(), &TestType);
if (ret==0)
{
    std::vector<CParserOutNode*>::iterator iter;
    iter = m_Param.begin();
    while (iter != m_Param.end())
    {
        // do code
    }
}
 
Share this answer
 
v2
Comments
Mahmoud_Gamal 14-Sep-14 6:01am    
it work on linux but windows no
vector<cparsertoken*> &cop =mycom->param;
// mycom->get_first();
iter = cop.begin();
int i = 0;
for(;iter!=cop.end();iter++)
{


k = ParseTokens(*iter,NULL,token, temp, polist,true);

if(k<0)
{

return k;
}
}
George Jonsson 14-Sep-14 6:08am    
What code is this?
Mahmoud_Gamal 14-Sep-14 6:31am    
i sorry for this i mean the same code dosen't run on windows but it run well on linux
George Jonsson 14-Sep-14 6:42am    
But this is a new question. Right?
Mahmoud_Gamal 14-Sep-14 7:50am    
i sorry for new question but i solved it it linux and run then i see your answer i try it in windows problem doesn't solve

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900