Jessica Watson
Jessica Watson

Reputation: 3

C++ error: No instance of overloaded function

I keep getting the same error with my code and still after searching through similar questions, I can't figure out what to do. Error occurs on the line stating "building[0].push_back(Person()".

std::vector<std::vector<Person()>> addPeople(std::vector<std::vector<Person()>> building)
    {
        std::poisson_distribution<int> distribution(0);
        for (int i = 0; i < 100; i++)
        {
            int test = distribution(generator);
            if (test >= 0 && test <= 6)
            {
                if (test = 0)
                {
                    building[0].push_back(Person());
                }
                else if (test = 6)
                {
                    building[0].push_back(Person());
                }
            }
        }

        return building;
    }

Upvotes: 0

Views: 202

Answers (1)

Jarod42
Jarod42

Reputation: 218323

std::vector<std::vector<Person()>> building should probably be std::vector<std::vector<Person>> building.

Person() in that context is a function taking nothing, and returning Person.

Upvotes: 1

Related Questions