for the set_intersection, it puts the result in the iterator result. I declare an array and put this array address in the iterator result, but how do I know how many elements are there in the result?
right now, after finish intersecting, i use a while loop to read the array to count the number of elements in the result
After hours of trying, I find a solution, hee.....
Code:
inline int Transactiondb::CreateSubg(int *set, int setcount, int *set_sub, structtid *r) {
int i=0, j=0, index=0, *add;
add = set_intersection(set, set+setcount, r->tidptr, r->tidptr+(r->transnum), set_sub);
index = (add - set_sub)-1 / sizeof(int); // since add is the last pointer in set_sub
return index;
}