JulioBeta
asked on
Problem with insert in STL list
Hi!
This is the code that gives me problem
std::list<AnsiString> l_pPadres;//list with elements: "uno" "dos" "tres" "cuatro"
std::list<AnsiString> l_pHijos;//list with elements: "alfa" "beta" "delta"
//I wont insert all l_pHijos elments between elements "dos" and "tres" of the list l_pPadres
//Then the list l_Padres must be:: "uno" "dos" "alfa" "beta" "delta" "tres" "cuatro"
//1 step: I found where is "dos " in the list l_pPadres
std::list<AnsiString>::ite rator mi3Iterador;
for(mi3Iterador = l_pPadres.begin();mi3Itera dor != l_pPadres.end();mi3Iterado r++)
{//begin for mi3Iterador
if(*mi3Iterador) == AnsiString("dos"))
break;
}//end for mi3Iterador
//2 step: I put the pointer after "dos"
mi3Iterador++;
//3 step: I try to do the insertion
mi3Iterador.insert(mi3Iter ador, l_pHijos.begin(), l_pHijos.end());
//4 ste: When I compiled I have the following message error:
list<AnsiString,allocator< AnsiString >>::iterat or
Please, could anyone help me?
Regards
This is the code that gives me problem
std::list<AnsiString> l_pPadres;//list with elements: "uno" "dos" "tres" "cuatro"
std::list<AnsiString> l_pHijos;//list with elements: "alfa" "beta" "delta"
//I wont insert all l_pHijos elments between elements "dos" and "tres" of the list l_pPadres
//Then the list l_Padres must be:: "uno" "dos" "alfa" "beta" "delta" "tres" "cuatro"
//1 step: I found where is "dos " in the list l_pPadres
std::list<AnsiString>::ite
for(mi3Iterador = l_pPadres.begin();mi3Itera
{//begin for mi3Iterador
if(*mi3Iterador) == AnsiString("dos"))
break;
}//end for mi3Iterador
//2 step: I put the pointer after "dos"
mi3Iterador++;
//3 step: I try to do the insertion
mi3Iterador.insert(mi3Iter
//4 ste: When I compiled I have the following message error:
list<AnsiString,allocator<
Please, could anyone help me?
Regards
can you post the exact error message?
ASKER
The exact errer message is:
list<AnsiString,allocator< AnsiString >>::iterat or
list<AnsiString,allocator<
> The exact errer message is:
> list<AnsiString,allocator< AnsiString >>::iterat or
I do not know any compiler which gives an error just like that.
Normally a compiler error looks like this:
bankaccount.h(14) : error C2146: syntax error : missing ';' before identifier 'm_Name2'
> list<AnsiString,allocator<
I do not know any compiler which gives an error just like that.
Normally a compiler error looks like this:
bankaccount.h(14) : error C2146: syntax error : missing ';' before identifier 'm_Name2'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks.
Your answer has the solution to my problem.
Regards
JulioBeta
Your answer has the solution to my problem.
Regards
JulioBeta