max_size.pass.cpp revision ebedffde9adff4b56d3ccf6adcee8dc092404f0e
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// <memory>
11
12// template <class OuterAlloc, class... InnerAllocs>
13//   class scoped_allocator_adaptor
14
15// size_type max_size() const;
16
17#include <scoped_allocator>
18#include <cassert>
19
20#include "allocators.h"
21
22int main()
23{
24#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
25
26    {
27        typedef std::scoped_allocator_adaptor<A1<int>> A;
28        const A a(A1<int>(100));
29        assert(a.max_size() == 100);
30    }
31    {
32        typedef std::scoped_allocator_adaptor<A1<int>, A2<int>> A;
33        const A a(A1<int>(20), A2<int>());
34        assert(a.max_size() == 20);
35    }
36    {
37        typedef std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>> A;
38        const A a(A1<int>(200), A2<int>(), A3<int>());
39        assert(a.max_size() == 200);
40    }
41
42#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
43}
44