Home | History | Annotate | Download | only in priqueue.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 priority_queue(const Compare& comp, const container_type& c);
     13 
     14 #include <queue>
     15 #include <cassert>
     16 #include <functional>
     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::vector<int> v = make<std::vector<int> >(5);
     31     std::priority_queue<int, std::vector<int>, std::greater<int> > q(std::greater<int>(), v);
     32     assert(q.size() == 5);
     33     assert(q.top() == 0);
     34 }
     35