I am writing a program with a list of the type Artikel and in the list there are several elements that each contains 4 data members, 2 int and 2 string. The list is sorted by int artikelNr and the function below is supposed to add a new Artikel to the list at the right spot with its artikelNr in mind. Although since the list is of the type Artikel and the data member I am comparing with is Int I get the error: base operand of '->' has non-pointer type 'Artikel'|
I have tried to make an iterator *it to the list of the type int but it does not work since the list is of the type Artikel.
void Lager::lagg_till_registret(Artikel funkArtikel)  
{
bool check = false;
list<Artikel>::iterator it = listaMedArtiklar.begin();
while(check == false){
   if(funkArtikel.artikelNr < (*it)->artikelNr){
        listaMedArtiklar.insert (it,funkArtikel);
        check = true;
    }
    else
        it++;
}
}
    
it->artikelNr. (*itisn't a pointer.)Artikelis a pointer !?artikelNris a function, you need the "()", but you didn't write any.