Home | History | Annotate | Download | only in stack.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 // <stack>
     11 
     12 // template <class Alloc>
     13 //   explicit stack(const Alloc& a);
     14 
     15 #include <stack>
     16 #include <cassert>
     17 
     18 #include "test_macros.h"
     19 #include "test_allocator.h"
     20 
     21 struct test
     22     : private std::stack<int, std::deque<int, test_allocator<int> > >
     23 {
     24     typedef std::stack<int, std::deque<int, test_allocator<int> > > base;
     25 
     26     explicit test(const test_allocator<int>& a) : base(a) {}
     27     test(const container_type& c, const test_allocator<int>& a) : base(c, a) {}
     28 #if TEST_STD_VER >= 11
     29     test(container_type&& c, const test_allocator<int>& a) : base(std::move(c), a) {}
     30     test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
     31 #endif
     32     test_allocator<int> get_allocator() {return c.get_allocator();}
     33 };
     34 
     35 int main()
     36 {
     37     test q(test_allocator<int>(3));
     38     assert(q.get_allocator() == test_allocator<int>(3));
     39 }
     40