Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / libc++ / trunk / test / containers / sequences / vector / vector.data / data_const.pass.cpp
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 // <vector>
11
12 // const_pointer data() const;
13
14 #include <vector>
15 #include <cassert>
16
17 #include "min_allocator.h"
18 #include "asan_testing.h"
19
20 int main()
21 {
22     {
23         const std::vector<int> v;
24         assert(v.data() == 0);
25         assert(is_contiguous_container_asan_correct(v)); 
26     }
27     {
28         const std::vector<int> v(100);
29         assert(v.data() == &v.front());
30         assert(is_contiguous_container_asan_correct(v)); 
31     }
32 #if __cplusplus >= 201103L
33     {
34         const std::vector<int, min_allocator<int>> v;
35         assert(v.data() == 0);
36         assert(is_contiguous_container_asan_correct(v)); 
37     }
38     {
39         const std::vector<int, min_allocator<int>> v(100);
40         assert(v.data() == &v.front());
41         assert(is_contiguous_container_asan_correct(v)); 
42     }
43 #endif
44 }