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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -