Standard C++ Library Class Reference
 {
 //Initialize a deque with an array of ints
 int arr1[5] = {99, 264, 126, 330, 132};
 int arr2[5] = {280, 105, 220, 84, 210};
 deque<int> d1(arr1, arr1+5), d2(arr2, arr2+5);
 //Print the original values
 cout << "The following pairs of numbers: " 
 << endl << " ";
 deque<int>::iterator i1;
 for(i1 = d1.begin(); i1 != d1.end(); i1++)
 cout << setw(6) << *i1 << " ";
 cout << endl << " ";
 for(i1 = d2.begin(); i1 != d2.end(); i1++)
 cout << setw(6) << *i1 << " ";
 // Transform the numbers in the deque to their 
 // factorials and store in the vector
 transform(d1.begin(), d1.end(), d2.begin(), 
 d1.begin(), times<int>());
 //Display the results
 cout << endl << endl;
 cout << "Have the products: " << endl << " ";
 for(i1 = d1.begin(); i1 != d1.end(); i1++)
 cout << setw(6) << *i1 << " ";
 return 0;
 }
Output :
The following pairs of numbers:
 99 264 126 330 132
 280 105 220 84 210
Have the products:
 27720 27720 27720 27720 27720
Warning
If your compiler does not support default template parameters, then you need to always supply
the Allocator template argument. For instance, you will need to write :
deque<int, allocator>
instead of:
deque<int>










