How copy elements of a container for the other container?

Hi, How copy elements of a container for the other container without a loop, because i have that change this code:

vector<int> vetor;

vetor.push_back(2);
vetor.push_back(4);
vetor.push_back(6);
vetor.push_back(9);

deque<int> fila;


while (!vetor.empty()){
fila.push_front(vetor.back());
vetor.pop_back();
}

//I want put the elements of the vector in the deque without this loop. Help me!

Sorry for my english!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
#include <vector>
#include <deque>
#include <list>

int main()
{
    std::vector<int> vec { 0, 1, 2, 3, 4, 5 } ;

    std::deque<long> deq( vec.begin(), vec.end() ) ; // initialise deq with the numbers in vec

    std::list<double> lst { 100, 200, 300 } ;
    lst.assign( deq.begin(), deq.end() ) ; // replace the contents of lst wih numbers in deq
    lst = { vec.begin(), vec.end() } ; // replace the contents of lst wih numbers in vec
}
Thanks!
Topic archived. No new replies allowed.