1//===----------------------------------------------------------------------===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9// UNSUPPORTED: c++03
10
11// <deque>
12
13// deque(initializer_list<value_type> il, const Allocator& a = allocator_type());
14
15#include "asan_testing.h"
16#include <deque>
17#include <cassert>
18
19#include "test_macros.h"
20#include "test_allocator.h"
21#include "min_allocator.h"
22
23int main(int, char**)
24{
25 {
26 std::deque<int, test_allocator<int>> d({3, 4, 5, 6}, test_allocator<int>(3));
27 assert(d.get_allocator() == test_allocator<int>(3));
28 assert(d.size() == 4);
29 assert(d[0] == 3);
30 assert(d[1] == 4);
31 assert(d[2] == 5);
32 assert(d[3] == 6);
33 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
34 }
35 {
36 std::deque<int, min_allocator<int>> d({3, 4, 5, 6}, min_allocator<int>());
37 assert(d.get_allocator() == min_allocator<int>());
38 assert(d.size() == 4);
39 assert(d[0] == 3);
40 assert(d[1] == 4);
41 assert(d[2] == 5);
42 assert(d[3] == 6);
43 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
44 }
45
46 return 0;
47}
48

source code of libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp