Home | History | Annotate | Download | only in queue.cons
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <queue>
     11 
     12 // explicit queue(const container_type& c);
     13 
     14 #include <queue>
     15 #include <cassert>
     16 #include <cstddef>
     17 
     18 template <class C>
     19 C
     20 make(int n)
     21 {
     22     C c;
     23     for (int i = 0; i < n; ++i)
     24         c.push_back(i);
     25     return c;
     26 }
     27 
     28 int main()
     29 {
     30     std::deque<int> d = make<std::deque<int> >(5);
     31     std::queue<int> q(d);
     32     assert(q.size() == 5);
     33     for (std::size_t i = 0; i < d.size(); ++i)
     34     {
     35         assert(q.front() == d[i]);
     36         q.pop();
     37     }
     38 }
     39