samedi 30 janvier 2016

Incomplete type error when using std::vector with structs

I'm working with c++ STL vectors, and have a vector of structures called projectileList. I'm trying to iterate through the vector, getting and setting values in the struts as I iterate, but my code refuses to compile, with the error 'Incomplete type is not allowed.'

Can anyone please point out what I'm doing wrong:

Code:

struct projectile {
    bool isEditing;
    [Code omitted]
    }


class ProjectileHandeler {

private:
    std::vector<projectile> projectileList;

     [Irrelevant code omitted]


void ProjectileHandeler::projectileUpdater()
{
    //This bit loops to infinity and beyond! ...or at least untill the handeler is destroyed.
    while (true)
    {
        for (int i = 0; i < projectileList.size(); i++)
        {
            if (*projectileList[i].isEditing == true) //Throws Incomplete type error
                break;
        }
    }

}

}

Aucun commentaire:

Enregistrer un commentaire