nodes[i]
is a vector of integers. You're trying to append a vector to a vector of integers.
Either do:
nodes.push_back({i/c, i%c, -1, -1, 0});
or
nodes[i] = {i/c, i%c, -1, -1, 0};
The second solution being the best since you already gave the proper dimension to your vector. No need to add r*c
more elements...
in your code, either create empty, and populate with push_back
:
std::vector<std::vector<int>> nodes;
for(i = 0; i < r*c; i++)
{
nodes.push_back({i/c, i%c, -1, -1, 0});
}
or create with proper dimension and assign items:
std::vector<std::vector<int>> nodes (r*c, std::vector<int> (5));
for(i = 0; i < r*c; i++)
{
nodes[i] = {i/c, i%c, -1, -1, 0};
}