Home | History | Annotate | Download | only in priqueue.cons.alloc
      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 Alloc>
     13 //     priority_queue(const Compare& comp, const Alloc& a);
     14 
     15 #include <queue>
     16 #include <cassert>
     17 
     18 #include "test_macros.h"
     19 #include "test_allocator.h"
     20 
     21 template <class T>
     22 struct test
     23     : public std::priority_queue<T, std::vector<T, test_allocator<T> > >
     24 {
     25     typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
     26     typedef typename base::container_type container_type;
     27     typedef typename base::value_compare value_compare;
     28 
     29     explicit test(const test_allocator<int>& a) : base(a) {}
     30     test(const value_compare& comp, const test_allocator<int>& a)
     31         : base(comp, a) {}
     32     test(const value_compare& comp, const container_type& c,
     33         const test_allocator<int>& a) : base(comp, c, a) {}
     34 #if TEST_STD_VER >= 11
     35     test(const value_compare& comp, container_type&& c,
     36          const test_allocator<int>& a) : base(comp, std::move(c), a) {}
     37     test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
     38 #endif
     39     test_allocator<int> get_allocator() {return c.get_allocator();}
     40 
     41     using base::c;
     42 };
     43 
     44 int main()
     45 {
     46     test<int> q(std::less<int>(), test_allocator<int>(3));
     47     assert(q.c.get_allocator() == test_allocator<int>(3));
     48     assert(q.c.size() == 0);
     49 }
     50