blob: 0438869e83b3360c623495d8539c37bb2bc097bf [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// <memory>
11
12// template <class OuterAlloc, class... InnerAllocs>
13// class scoped_allocator_adaptor
14
15// outer_allocator_type& outer_allocator();
16// const outer_allocator_type& outer_allocator() const;
17
Howard Hinnante92c3d72010-08-19 18:39:17 +000018#include <scoped_allocator>
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000019#include <cassert>
20
21#include "../allocators.h"
22
23int main()
24{
Howard Hinnant73d21a42010-09-04 23:28:19 +000025#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000026
27 {
28 typedef std::scoped_allocator_adaptor<A1<int>> A;
29 A a(A1<int>(5));
30 assert(a.outer_allocator() == A1<int>(5));
31 }
32 {
33 typedef std::scoped_allocator_adaptor<A1<int>, A2<int>> A;
34 A a(A1<int>(5), A2<int>(6));
35 assert(a.outer_allocator() == A1<int>(5));
36 }
37 {
38 typedef std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>> A;
39 A a(A1<int>(5), A2<int>(6), A3<int>(8));
40 assert(a.outer_allocator() == A1<int>(5));
41 }
42
Howard Hinnant73d21a42010-09-04 23:28:19 +000043#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000044}