Assign new custom object from deque c++ -
i have:
deque<job> jobs; jobs.push_back(job(1));
where job custom class made (really simple, has job number), , want following:
job currentjob = jobs.pop_front();
however, gives me errors. how accomplish assigning popped job new job?
quoting documentation:
void pop_front();
delete first element removes first element in deque container, reducing size one.
this destroys removed element.
pop_front()
destroys object, may need try:
job currentjob = jobs.front(); jobs.pop_front(); //remove object container , reduce size 1
see std::deque::pop_front more information.
Comments
Post a Comment