blob: 853f75583ddc6f279b48e4a1e6e6d6afc14ff7a2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <vector>
// void assign(initializer_list<value_type> il);
#include <vector>
#include <cassert>
#include "min_allocator.h"
#include "asan_testing.h"
template <typename Vec>
void test ( Vec &v )
{
v.assign({3, 4, 5, 6});
assert(v.size() == 4);
assert(is_contiguous_container_asan_correct(v));
assert(v[0] == 3);
assert(v[1] == 4);
assert(v[2] == 5);
assert(v[3] == 6);
}
int main()
{
{
typedef std::vector<int> V;
V d1;
V d2;
d2.reserve(10); // no reallocation during assign.
test(d1);
test(d2);
}
{
typedef std::vector<int, min_allocator<int>> V;
V d1;
V d2;
d2.reserve(10); // no reallocation during assign.
test(d1);
test(d2);
}
}
|