Pass data from deque to list. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Pass data from deque to list.

How can I pass data from a deque to a list? Why this way is wrong? void Intercambio (deque<Data> &colas) { // Data aux; list <double> miLista; for( unsigned int i=0; i<colas.size(); i++) colas(i)=miLista.push_back(i); // miLista.push_back(i); for(int elem : miLista) cout<<" "<<elem; }

15th Oct 2016, 4:52 PM
David Viadas
David Viadas - avatar
1 Answer
0
1) The types of both containers are different. 2) You add and print ints to the list of double. Maybe you need the list of ints? 3) Use std::copy to copy the data.
30th Mar 2017, 10:47 PM
soman