1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
13 // list(list&& c, const allocator_type& a);
17 #include "test_macros.h"
19 #include "test_allocator.h"
20 #include "min_allocator.h"
25 std::list
<MoveOnly
, test_allocator
<MoveOnly
> > l(test_allocator
<MoveOnly
>(5));
26 std::list
<MoveOnly
, test_allocator
<MoveOnly
> > lo(test_allocator
<MoveOnly
>(5));
27 for (int i
= 1; i
<= 3; ++i
)
32 std::list
<MoveOnly
, test_allocator
<MoveOnly
> > l2(std::move(l
), test_allocator
<MoveOnly
>(6));
35 assert(l2
.get_allocator() == test_allocator
<MoveOnly
>(6));
38 std::list
<MoveOnly
, test_allocator
<MoveOnly
> > l(test_allocator
<MoveOnly
>(5));
39 std::list
<MoveOnly
, test_allocator
<MoveOnly
> > lo(test_allocator
<MoveOnly
>(5));
40 for (int i
= 1; i
<= 3; ++i
)
45 std::list
<MoveOnly
, test_allocator
<MoveOnly
> > l2(std::move(l
), test_allocator
<MoveOnly
>(5));
48 assert(l2
.get_allocator() == test_allocator
<MoveOnly
>(5));
51 std::list
<MoveOnly
, other_allocator
<MoveOnly
> > l(other_allocator
<MoveOnly
>(5));
52 std::list
<MoveOnly
, other_allocator
<MoveOnly
> > lo(other_allocator
<MoveOnly
>(5));
53 for (int i
= 1; i
<= 3; ++i
)
58 std::list
<MoveOnly
, other_allocator
<MoveOnly
> > l2(std::move(l
), other_allocator
<MoveOnly
>(4));
61 assert(l2
.get_allocator() == other_allocator
<MoveOnly
>(4));
64 std::list
<MoveOnly
, min_allocator
<MoveOnly
> > l(min_allocator
<MoveOnly
>{});
65 std::list
<MoveOnly
, min_allocator
<MoveOnly
> > lo(min_allocator
<MoveOnly
>{});
66 for (int i
= 1; i
<= 3; ++i
)
71 std::list
<MoveOnly
, min_allocator
<MoveOnly
> > l2(std::move(l
), min_allocator
<MoveOnly
>());
74 assert(l2
.get_allocator() == min_allocator
<MoveOnly
>());