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// <deque>
10
11// explicit deque(const allocator_type& a);
12
13#include "asan_testing.h"
14#include <deque>
15#include <cassert>
16
17#include "test_macros.h"
18#include "test_allocator.h"
19#include "../../../NotConstructible.h"
20#include "min_allocator.h"
21
22template <class T, class Allocator>
23void test(const Allocator& a) {
24 std::deque<T, Allocator> d(a);
25 assert(d.size() == 0);
26 assert(d.get_allocator() == a);
27 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
28}
29
30int main(int, char**) {
31 test<int>(std::allocator<int>());
32 test<NotConstructible>(test_allocator<NotConstructible>(3));
33#if TEST_STD_VER >= 11
34 test<int>(min_allocator<int>());
35 test<int>(safe_allocator<int>());
36 test<NotConstructible>(min_allocator<NotConstructible>{});
37 test<NotConstructible>(safe_allocator<NotConstructible>{});
38 test<int>(explicit_allocator<int>());
39 test<NotConstructible>(explicit_allocator<NotConstructible>{});
40#endif
41
42 return 0;
43}
44

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