I have vector
std::vector<OrderInfo *> vec
and a queue
queue<OrderInfo *> *myQueue = new queue<OrderInfo *>;
I want to copy the vector into the queue. I tried using How can I copy an entire vector into a queue? this answer and also this Insert into an STL queue using std::copy
but it's not working, how do I make it work?
this is what I tried: myQueue = new queue(vec.begin(), vec.end()); i got
error: no matching function for call to ‘std::queue::queue(std::vector::iterator, std::vector::iterator)’ myQueue = new queue(vec.begin(), vec.end());
and when I tried this:
std::copy(vec.begin(),vec.end(),std::back_inserter(myQueue));
i got:
required from ‘BacStrategy::BacStrategy(EZXConnectionHandler&, const string&, bool, const double&, int) [with Event_Type = EZXOrderEventHandler; std::__cxx11::string = std::__cxx11::basic_string]’ /home/yaodav/Desktop/git_repo/test/main.cpp:324:51: required from here /usr/local/include/c++/7.4.0/bits/stl_iterator.h:490:7: error: ‘std::queue*’ is not a class, struct, or union type operator=(const typename _Container::value_type& __value)