I have problem i need to convert from my “Array” structure to std::vector<int>… the point is i have a dynamic matrix who purpose is being Database. But at some point i need to move some values from the ‘Array’ to a vector. and i get the fallowing error
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/bits /stl_iterator_base_types.h:166:53: error: 'int' is not a class, struct, or union type
Anyone has some clue how to achive this thing?
structure:
const int days=31;
const int exp=6;
struct Arr{
int days;
int exp;
int **M;
};
typedef Arr* Array;
vector:
vector <int> vec(31);
EDIT:
int dayExp(int day, Array &M){
int s=0;
for(int i=0;i<6;i++){
s += M->M[day][i];
}
return s;
}
void srtDesc(Array &M){
vector <int> vec(31);
for(int i=0;i<31;i++){
vec[i]=dayExp(i, M);
}
sort(vec[0],vec[1]);
for(int i=0;i<31;i++){
cout<< vec[i];
}
}
Your
Arrstruct does not implicitly convert toint. First of all, your struct contains 3inttypes, whereas avector<int>is oneintat a time.If you want to put your
Arrinto avector, you should create astd::vector<Arr>and then callpush_backon it to put yourArrstructs in it.You will need to create
forloop that goes through the length – 1 of your array and callspush_backto put each item in thevector