I tried to add a structure into t but there is error. I also try to declare <vector>int tidptr in sttucttid, but there is error too..Code:struct structtid { int tid; //transaction id list int *tidptr; // pointer to the transaction int transnum; //size of each transaction }; <vector>structtid t; structtid temp; temp.tid = 1; temp.transnum = 10; t.push_back(temp);
Can anyone help me? Thanks!



LinkBack URL
About LinkBacks



I also added onto your code. A nifty feature of C++ is the fact the structs and classes are exactly the same (public vs. private, whatev). This means you can have a struct constructor, reducing the need for your temporary struct to push onto the vector. This code works fine for me.