0

so first of all here is my code:

#include "Data.h"
#include "Ant.h"

using namespace std;

#define NUMBERANTS 500

int main() {

init();

vector<Ant> antarmy;
antarmy.reserve(NUMBERANTS);
int currentAntNumber = 1;

fill(antarmy.begin(), antarmy.end(), Ant());

for each (Ant ant in antarmy) {
    ant.setNumber(currentAntNumber);
    currentAntNumber++;
    ant.antRoute(ant);
}


system("pause");
return 0;

}

I have a vector of objects (Ant) and I defined the size of the vector. Now I want to initiliaze it with the number of Objects. But

fill(antarmy.begin(), antarmy.end(), Ant());

doesnt work somehow. So what do I have to change?

Thanks for your help

Samy Dressel
  • 143
  • 1
  • 13

0 Answers0