Home | History | Annotate | Download | only in priority.queue
      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 // template <class T, class Container = vector<T>,
     13 //           class Compare = less<typename Container::value_type>>
     14 // class priority_queue
     15 // {
     16 // public:
     17 //     typedef Container                                container_type;
     18 //     typedef typename container_type::value_type      value_type;
     19 //     typedef typename container_type::reference       reference;
     20 //     typedef typename container_type::const_reference const_reference;
     21 //     typedef typename container_type::size_type       size_type;
     22 //
     23 // protected:
     24 //     container_type c;
     25 //     Compare comp;
     26 
     27 #include <queue>
     28 #include <cassert>
     29 #include <type_traits>
     30 
     31 struct test
     32     : private std::priority_queue<int>
     33 {
     34     test()
     35     {
     36         c.push_back(1);
     37         assert(comp(1, 2));
     38     }
     39 };
     40 
     41 struct C
     42 {
     43     typedef int value_type;
     44     typedef int& reference;
     45     typedef const int& const_reference;
     46     typedef int size_type;
     47 };
     48 
     49 int main()
     50 {
     51     static_assert((std::is_same<std::priority_queue<int>::container_type, std::vector<int> >::value), "");
     52     static_assert((std::is_same<std::priority_queue<double, std::deque<int> >::container_type, std::deque<int> >::value), "");
     53     static_assert((std::is_same<std::priority_queue<double, std::deque<int> >::value_type, int>::value), "");
     54     static_assert((std::is_same<std::priority_queue<int>::reference, std::vector<int>::reference>::value), "");
     55     static_assert((std::is_same<std::priority_queue<int>::const_reference, std::vector<int>::const_reference>::value), "");
     56     static_assert((std::is_same<std::priority_queue<int>::size_type, std::vector<int>::size_type>::value), "");
     57     static_assert((std::uses_allocator<std::priority_queue<int>, std::allocator<int> >::value), "");
     58     static_assert((!std::uses_allocator<std::priority_queue<int, C>, std::allocator<int> >::value), "");
     59     test t;
     60 }
     61