Assigning a name to ecah componnet of 3D array

Hello everyone,
I have a 3D array which I want to give name. I do, but it gives me an error about BestX (says that it must be a class ,what is wrong here? Can you tell me please ? Thank you so much

1
2
3
4
5
6
7
8
9
10
  	char varName[1000];
	vector<vector<vector<double>>> BestX(nbP, vector<vector<double>>(nbM, vector<double>(nbPe)));
	for (IloInt i = 0; i < nbP; i++) {
		for (IloInt j = 0; j < nbM; j++) {
			for (IloInt k = 0; k < nbPe; k++) {
				printf(varName, "BestX_%d_%d_%d", (int)i, (int)j, (int)k);
				BestX[i][j][k].setName(varName);
			}
		}
	}
BestX[i][j][k] is double (which certainly has no member function setName(...)).

What do you expect that has a member function setName(...)?
Also, line 6 should be sprintf(), not printf()

Why do you want to assign names to each item in the array? What would you do with these names?
Topic archived. No new replies allowed.