c++ - Deque using custom class cannot push_back -
i getting following error when attempting push_back new custom object:
prog7.cpp:66: error: no matching function call ‘std::deque<job, std::allocator<job> >::push_back(job*)’ /usr/include/c++/4.4/bits/stl_deque.h:1201: note: candidates are: void std::deque<_tp, _alloc>::push_back(const _tp&) [with _tp = job, _alloc = std::allocator<job>]
relevant code here:
deque<job> jobs; jobs.push_back(new job());
am doing wrong here?
say this:
jobs.push_back(job()); // copy default-initialized object
or:
jobs.emplace_back(); // direct-initialize new object
Comments
Post a Comment