Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
Howard Hinnant | f5256e1 | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 4 | // |
Howard Hinnant | b64f8b0 | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 7 | // |
| 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 Clow | 061d0cc | 2013-11-26 20:58:02 +0000 | [diff] [blame^] | 19 | #include "min_allocator.h" |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 20 | |
| 21 | template <class C> |
| 22 | void |
| 23 | test0() |
| 24 | { |
| 25 | C c; |
| 26 | assert(c.__invariants()); |
| 27 | assert(c.empty()); |
| 28 | assert(c.get_allocator() == typename C::allocator_type()); |
| 29 | } |
| 30 | |
| 31 | template <class C> |
| 32 | void |
| 33 | test1(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 | |
| 41 | int main() |
| 42 | { |
| 43 | { |
| 44 | test0<std::vector<bool> >(); |
| 45 | test1<std::vector<bool, test_allocator<bool> > >(test_allocator<bool>(3)); |
| 46 | } |
Howard Hinnant | 2c39cbe | 2013-06-27 19:35:32 +0000 | [diff] [blame] | 47 | #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 Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 53 | } |