1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 // template <class InputIterator>
13 // deque(InputIterator f, InputIterator l, const allocator_type& a);
18 #include "test_iterators.h"
19 #include "test_allocator.h"
20 #include "min_allocator.h"
22 template <class InputIterator, class Allocator>
24 test(InputIterator f, InputIterator l, const Allocator& a)
26 typedef typename std::iterator_traits<InputIterator>::value_type T;
27 typedef std::deque<T, Allocator> C;
28 typedef typename C::const_iterator const_iterator;
30 assert(d.get_allocator() == a);
31 assert(d.size() == std::distance(f, l));
32 assert(distance(d.begin(), d.end()) == d.size());
33 for (const_iterator i = d.begin(), e = d.end(); i != e; ++i, ++f)
39 int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
40 int* an = ab + sizeof(ab)/sizeof(ab[0]);
41 test(input_iterator<const int*>(ab), input_iterator<const int*>(an), test_allocator<int>(3));
42 test(forward_iterator<const int*>(ab), forward_iterator<const int*>(an), test_allocator<int>(4));
43 test(bidirectional_iterator<const int*>(ab), bidirectional_iterator<const int*>(an), test_allocator<int>(5));
44 test(random_access_iterator<const int*>(ab), random_access_iterator<const int*>(an), test_allocator<int>(6));
45 #if TEST_STD_VER >= 11
46 test(input_iterator<const int*>(ab), input_iterator<const int*>(an), min_allocator<int>());
47 test(forward_iterator<const int*>(ab), forward_iterator<const int*>(an), min_allocator<int>());
48 test(bidirectional_iterator<const int*>(ab), bidirectional_iterator<const int*>(an), min_allocator<int>());
49 test(random_access_iterator<const int*>(ab), random_access_iterator<const int*>(an), min_allocator<int>());