//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // template deque(InputIterator f, InputIterator l); #include #include #include "../../../stack_allocator.h" #include "../../../iterators.h" template void test(InputIterator f, InputIterator l) { typedef typename std::iterator_traits::value_type T; typedef std::allocator Allocator; typedef std::deque C; typedef typename C::const_iterator const_iterator; C d(f, l); assert(d.size() == std::distance(f, l)); assert(distance(d.begin(), d.end()) == d.size()); for (const_iterator i = d.begin(), e = d.end(); i != e; ++i, ++f) assert(*i == *f); } template void test(InputIterator f, InputIterator l) { typedef typename std::iterator_traits::value_type T; typedef std::deque C; typedef typename C::const_iterator const_iterator; C d(f, l); assert(d.size() == std::distance(f, l)); assert(distance(d.begin(), d.end()) == d.size()); for (const_iterator i = d.begin(), e = d.end(); i != e; ++i, ++f) assert(*i == *f); } int main() { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab)/sizeof(ab[0]); test(input_iterator(ab), input_iterator(an)); test(forward_iterator(ab), forward_iterator(an)); test(bidirectional_iterator(ab), bidirectional_iterator(an)); test(random_access_iterator(ab), random_access_iterator(an)); test >(ab, an); }