S
slurper
i have problems with following piece of code
vector<job> jobvector; (i put some jobs in this vector)
list<job*> joblist;
void copy_vector_into_list() {
vector<job>::iterator iter = jobvector.begin();
for ( iter; iter != jobvector.end(); ++iter ) {
joblist.push_back(iter);
}
}
what i want:
i have a vector of jobs
i want to add the jobs to the list also, but to avoid a copy of the job, i
want to use pointers to jobs, so that no copies for jobs need to be made.
but there seems to be a problem
iter is vector<job>::iterator. i want to do a push_back on the list of the
job pointed to by the iterator. how should i do this?? casting? but how?
i make the copy (of pointers) because i want to manipulate the list and keep
the vector.
tx for help
vector<job> jobvector; (i put some jobs in this vector)
list<job*> joblist;
void copy_vector_into_list() {
vector<job>::iterator iter = jobvector.begin();
for ( iter; iter != jobvector.end(); ++iter ) {
joblist.push_back(iter);
}
}
what i want:
i have a vector of jobs
i want to add the jobs to the list also, but to avoid a copy of the job, i
want to use pointers to jobs, so that no copies for jobs need to be made.
but there seems to be a problem
iter is vector<job>::iterator. i want to do a push_back on the list of the
job pointed to by the iterator. how should i do this?? casting? but how?
i make the copy (of pointers) because i want to manipulate the list and keep
the vector.
tx for help