Link to home
Start Free TrialLog in
Avatar of JulioBeta
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>::iterator mi3Iterador;
for(mi3Iterador = l_pPadres.begin();mi3Iterador != l_pPadres.end();mi3Iterador++)
{//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(mi3Iterador, l_pHijos.begin(), l_pHijos.end());

//4 ste: When I compiled I have the following message error:
list<AnsiString,allocator<AnsiString>>::iterator

Please, could anyone help me?
Regards
Avatar of cwwkie
cwwkie

can you post the exact error message?
Avatar of JulioBeta

ASKER

The exact errer message is:
list<AnsiString,allocator<AnsiString>>::iterator
> The exact errer message is:
> list<AnsiString,allocator<AnsiString>>::iterator

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
Avatar of pmdw
pmdw
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks.
Your answer has the solution to my problem.

Regards
JulioBeta