copy_alloc.pass.cpp revision 1b92188a82b01e76ac6e8ad5f997293c2a078adc
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// <list>
11
12// list(const list& c, const allocator_type& a);
13
14#include <list>
15#include <cassert>
16#include "DefaultOnly.h"
17#include "test_allocator.h"
18#include "min_allocator.h"
19
20int main()
21{
22    {
23        std::list<int, test_allocator<int> > l(3, 2, test_allocator<int>(5));
24        std::list<int, test_allocator<int> > l2(l, test_allocator<int>(3));
25        assert(l2 == l);
26        assert(l2.get_allocator() == test_allocator<int>(3));
27    }
28    {
29        std::list<int, other_allocator<int> > l(3, 2, other_allocator<int>(5));
30        std::list<int, other_allocator<int> > l2(l, other_allocator<int>(3));
31        assert(l2 == l);
32        assert(l2.get_allocator() == other_allocator<int>(3));
33    }
34#if __cplusplus >= 201103L
35    {
36        std::list<int, min_allocator<int> > l(3, 2, min_allocator<int>());
37        std::list<int, min_allocator<int> > l2(l, min_allocator<int>());
38        assert(l2 == l);
39        assert(l2.get_allocator() == min_allocator<int>());
40    }
41#endif
42}
43