blob: 2ae47cddf22a4a200a473a043c6782153fb882d7 [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnantf5256e12010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00004//
5// This file is distributed under the University of Illinois Open Source
6// License. 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_allocator.h"
19
20struct test
21 : private std::stack<int, std::deque<int, test_allocator<int> > >
22{
23 typedef std::stack<int, std::deque<int, test_allocator<int> > > base;
24
25 explicit test(const test_allocator<int>& a) : base(a) {}
26 test(const container_type& c, const test_allocator<int>& a) : base(c, a) {}
Howard Hinnant73d21a42010-09-04 23:28:19 +000027#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000028 test(container_type&& c, const test_allocator<int>& a) : base(std::move(c), a) {}
29 test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
Howard Hinnant73d21a42010-09-04 23:28:19 +000030#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000031 test_allocator<int> get_allocator() {return c.get_allocator();}
32};
33
34int main()
35{
36 test q(test_allocator<int>(3));
37 assert(q.get_allocator() == test_allocator<int>(3));
38}