blob: f7ec5db5e9bd2e4cb927228c17daafeada1881e2 [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnantf5256e12010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00004//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00007//
8//===----------------------------------------------------------------------===//
9
10// <vector>
11// vector<bool>
12
13// vector(const Alloc& = Alloc());
14
15#include <vector>
16#include <cassert>
17
18#include "../../test_allocator.h"
Marshall Clow061d0cc2013-11-26 20:58:02 +000019#include "min_allocator.h"
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000020
21template <class C>
22void
23test0()
24{
25 C c;
26 assert(c.__invariants());
27 assert(c.empty());
28 assert(c.get_allocator() == typename C::allocator_type());
29}
30
31template <class C>
32void
33test1(const typename C::allocator_type& a)
34{
35 C c(a);
36 assert(c.__invariants());
37 assert(c.empty());
38 assert(c.get_allocator() == a);
39}
40
41int main()
42{
43 {
44 test0<std::vector<bool> >();
45 test1<std::vector<bool, test_allocator<bool> > >(test_allocator<bool>(3));
46 }
Howard Hinnant2c39cbe2013-06-27 19:35:32 +000047#if __cplusplus >= 201103L
48 {
49 test0<std::vector<bool, min_allocator<bool>> >();
50 test1<std::vector<bool, min_allocator<bool> > >(min_allocator<bool>());
51 }
52#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000053}