2010-05-11 21:42:16 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2010-05-11 23:36:01 +02:00
|
|
|
// The LLVM Compiler Infrastructure
|
2010-05-11 21:42:16 +02:00
|
|
|
//
|
2010-11-16 23:09:02 +01:00
|
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
|
|
// Source Licenses. See LICENSE.TXT for details.
|
2010-05-11 21:42:16 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// <deque>
|
|
|
|
|
|
|
|
// explicit deque(size_type n);
|
|
|
|
|
|
|
|
#include <deque>
|
|
|
|
#include <cassert>
|
|
|
|
|
|
|
|
#include "../../../stack_allocator.h"
|
|
|
|
#include "../../../DefaultOnly.h"
|
|
|
|
|
|
|
|
template <class T, class Allocator>
|
|
|
|
void
|
|
|
|
test(unsigned n)
|
|
|
|
{
|
|
|
|
typedef std::deque<T, Allocator> C;
|
|
|
|
typedef typename C::const_iterator const_iterator;
|
|
|
|
assert(DefaultOnly::count == 0);
|
|
|
|
{
|
|
|
|
C d(n);
|
|
|
|
assert(DefaultOnly::count == n);
|
|
|
|
assert(d.size() == n);
|
|
|
|
assert(distance(d.begin(), d.end()) == d.size());
|
2010-09-05 01:28:19 +02:00
|
|
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2010-05-11 21:42:16 +02:00
|
|
|
for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
|
|
|
|
assert(*i == T());
|
2010-09-05 01:28:19 +02:00
|
|
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2010-05-11 21:42:16 +02:00
|
|
|
}
|
|
|
|
assert(DefaultOnly::count == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
test<DefaultOnly, std::allocator<DefaultOnly> >(0);
|
|
|
|
test<DefaultOnly, std::allocator<DefaultOnly> >(1);
|
|
|
|
test<DefaultOnly, std::allocator<DefaultOnly> >(10);
|
|
|
|
test<DefaultOnly, std::allocator<DefaultOnly> >(1023);
|
|
|
|
test<DefaultOnly, std::allocator<DefaultOnly> >(1024);
|
|
|
|
test<DefaultOnly, std::allocator<DefaultOnly> >(1025);
|
|
|
|
test<DefaultOnly, std::allocator<DefaultOnly> >(2047);
|
|
|
|
test<DefaultOnly, std::allocator<DefaultOnly> >(2048);
|
|
|
|
test<DefaultOnly, std::allocator<DefaultOnly> >(2049);
|
|
|
|
test<DefaultOnly, std::allocator<DefaultOnly> >(4095);
|
|
|
|
test<DefaultOnly, std::allocator<DefaultOnly> >(4096);
|
|
|
|
test<DefaultOnly, std::allocator<DefaultOnly> >(4097);
|
|
|
|
test<DefaultOnly, stack_allocator<DefaultOnly, 4096> >(4095);
|
|
|
|
}
|