[libcxx] r184673 - Implement full support for non-pointer pointers in custom allocators for deque.
Howard Hinnant
hhinnant at apple.com
Sun Jun 23 14:17:24 PDT 2013
Author: hhinnant
Date: Sun Jun 23 16:17:24 2013
New Revision: 184673
URL: http://llvm.org/viewvc/llvm-project?rev=184673&view=rev
Log:
Implement full support for non-pointer pointers in custom allocators for deque.
Modified:
libcxx/trunk/include/__split_buffer
libcxx/trunk/include/deque
libcxx/trunk/test/containers/sequences/deque/deque.capacity/access.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.cons/alloc.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.cons/copy.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.cons/default.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.cons/initializer_list.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.cons/iter_iter.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.cons/move.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.cons/move_alloc.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.cons/move_assign.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.cons/op_equal.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.cons/size.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.cons/size_value.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.modifiers/emplace.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.modifiers/push_back.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.modifiers/push_front.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.special/copy.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.special/copy_backward.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.special/move.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.special/move_backward.pass.cpp
libcxx/trunk/test/containers/sequences/deque/deque.special/swap.pass.cpp
libcxx/trunk/test/containers/sequences/deque/iterators.pass.cpp
libcxx/trunk/test/containers/sequences/deque/types.pass.cpp
Modified: libcxx/trunk/include/__split_buffer
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__split_buffer?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/include/__split_buffer (original)
+++ libcxx/trunk/include/__split_buffer Sun Jun 23 16:17:24 2013
@@ -290,7 +290,7 @@ void
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
{
while (__begin_ != __new_begin)
- __alloc_traits::destroy(__alloc(), __begin_++);
+ __alloc_traits::destroy(__alloc(), __to_raw_pointer(__begin_++));
}
template <class _Tp, class _Allocator>
@@ -307,7 +307,7 @@ void
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
{
while (__new_last != __end_)
- __alloc_traits::destroy(__alloc(), --__end_);
+ __alloc_traits::destroy(__alloc(), __to_raw_pointer(--__end_));
}
template <class _Tp, class _Allocator>
@@ -320,7 +320,7 @@ __split_buffer<_Tp, _Allocator>::__destr
template <class _Tp, class _Allocator>
__split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a)
- : __end_cap_(0, __a)
+ : __end_cap_(nullptr, __a)
{
__first_ = __cap != 0 ? __alloc_traits::allocate(__alloc(), __cap) : nullptr;
__begin_ = __end_ = __first_ + __start;
@@ -331,21 +331,21 @@ template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
__split_buffer<_Tp, _Allocator>::__split_buffer()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
- : __first_(0), __begin_(0), __end_(0), __end_cap_(0)
+ : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr)
{
}
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
__split_buffer<_Tp, _Allocator>::__split_buffer(__alloc_rr& __a)
- : __first_(0), __begin_(0), __end_(0), __end_cap_(0, __a)
+ : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)
{
}
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
__split_buffer<_Tp, _Allocator>::__split_buffer(const __alloc_rr& __a)
- : __first_(0), __begin_(0), __end_(0), __end_cap_(0, __a)
+ : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)
{
}
Modified: libcxx/trunk/include/deque
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/deque?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/include/deque (original)
+++ libcxx/trunk/include/deque Sun Jun 23 16:17:24 2013
@@ -915,7 +915,14 @@ protected:
__pointer_allocator;
typedef allocator_traits<__pointer_allocator> __map_traits;
typedef typename __map_traits::pointer __map_pointer;
- typedef typename __map_traits::const_pointer __map_const_pointer;
+ typedef typename __alloc_traits::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+ rebind_alloc<const_pointer>
+#else
+ rebind_alloc<const_pointer>::other
+#endif
+ __const_pointer_allocator;
+ typedef typename allocator_traits<__const_pointer_allocator>::const_pointer __map_const_pointer;
typedef __split_buffer<pointer, __pointer_allocator> __map;
typedef __deque_iterator<value_type, pointer, reference, __map_pointer,
@@ -1053,7 +1060,7 @@ template <class _Tp, class _Allocator>
typename __deque_base<_Tp, _Allocator>::const_iterator
__deque_base<_Tp, _Allocator>::begin() const _NOEXCEPT
{
- __map_const_pointer __mp = __map_.begin() + __start_ / __block_size;
+ __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __start_ / __block_size);
return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size);
}
@@ -1071,7 +1078,7 @@ typename __deque_base<_Tp, _Allocator>::
__deque_base<_Tp, _Allocator>::end() const _NOEXCEPT
{
size_type __p = size() + __start_;
- __map_const_pointer __mp = __map_.begin() + __p / __block_size;
+ __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __p / __block_size);
return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size);
}
@@ -1341,6 +1348,8 @@ public:
_LIBCPP_INLINE_VISIBILITY
bool __invariants() const {return __base::__invariants();}
private:
+ typedef typename __base::__map_const_pointer __map_const_pointer;
+
_LIBCPP_INLINE_VISIBILITY
static size_type __recommend_blocks(size_type __n)
{
@@ -2505,9 +2514,9 @@ void
deque<_Tp, _Allocator>::pop_front()
{
allocator_type& __a = __base::__alloc();
- __alloc_traits::destroy(__a, *(__base::__map_.begin() +
- __base::__start_ / __base::__block_size) +
- __base::__start_ % __base::__block_size);
+ __alloc_traits::destroy(__a, __to_raw_pointer(*(__base::__map_.begin() +
+ __base::__start_ / __base::__block_size) +
+ __base::__start_ % __base::__block_size));
--__base::size();
if (++__base::__start_ >= 2 * __base::__block_size)
{
@@ -2523,9 +2532,9 @@ deque<_Tp, _Allocator>::pop_back()
{
allocator_type& __a = __base::__alloc();
size_type __p = __base::size() + __base::__start_ - 1;
- __alloc_traits::destroy(__a, *(__base::__map_.begin() +
- __p / __base::__block_size) +
- __p % __base::__block_size);
+ __alloc_traits::destroy(__a, __to_raw_pointer(*(__base::__map_.begin() +
+ __p / __base::__block_size) +
+ __p % __base::__block_size));
--__base::size();
if (__back_spare() >= 2 * __base::__block_size)
{
@@ -2556,7 +2565,7 @@ deque<_Tp, _Allocator>::__move_and_check
__fe = __fb + __bs;
}
if (__fb <= __vt && __vt < __fe)
- __vt = (const_iterator(__f.__m_iter_, __vt) -= __f - __r).__ptr_;
+ __vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) -= __f - __r).__ptr_;
__r = _VSTD::move(__fb, __fe, __r);
__n -= __bs;
__f += __bs;
@@ -2587,7 +2596,7 @@ deque<_Tp, _Allocator>::__move_backward_
__lb = __le - __bs;
}
if (__lb <= __vt && __vt < __le)
- __vt = (const_iterator(__l.__m_iter_, __vt) += __r - __l - 1).__ptr_;
+ __vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) += __r - __l - 1).__ptr_;
__r = _VSTD::move_backward(__lb, __le, __r);
__n -= __bs;
__l -= __bs - 1;
@@ -2618,7 +2627,7 @@ deque<_Tp, _Allocator>::__move_construct
__fe = __fb + __bs;
}
if (__fb <= __vt && __vt < __fe)
- __vt = (const_iterator(__f.__m_iter_, __vt) += __r - __f).__ptr_;
+ __vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) += __r - __f).__ptr_;
for (; __fb != __fe; ++__fb, ++__r, ++__base::size())
__alloc_traits::construct(__a, _VSTD::addressof(*__r), _VSTD::move(*__fb));
__n -= __bs;
@@ -2654,7 +2663,7 @@ deque<_Tp, _Allocator>::__move_construct
__lb = __le - __bs;
}
if (__lb <= __vt && __vt < __le)
- __vt = (const_iterator(__l.__m_iter_, __vt) -= __l - __r + 1).__ptr_;
+ __vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) -= __l - __r + 1).__ptr_;
while (__le != __lb)
{
__alloc_traits::construct(__a, _VSTD::addressof(*--__r), _VSTD::move(*--__le));
Modified: libcxx/trunk/test/containers/sequences/deque/deque.capacity/access.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.capacity/access.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.capacity/access.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.capacity/access.pass.cpp Sun Jun 23 16:17:24 2013
@@ -24,7 +24,10 @@
#include <deque>
#include <cassert>
-std::deque<int>
+#include "../../../min_allocator.h"
+
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -35,7 +38,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<int> c(init, 0);
+ C c(init, 0);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -48,7 +51,26 @@ make(int size, int start = 0 )
int main()
{
{
- std::deque<int> c = make(10);
+ std::deque<int> c = make<std::deque<int> >(10);
+ for (unsigned i = 0; i < 10; ++i)
+ assert(c[i] == i);
+ for (unsigned i = 0; i < 10; ++i)
+ assert(c.at(i) == i);
+ assert(c.front() == 0);
+ assert(c.back() == 9);
+ }
+ {
+ const std::deque<int> c = make<std::deque<int> >(10);
+ for (unsigned i = 0; i < 10; ++i)
+ assert(c[i] == i);
+ for (unsigned i = 0; i < 10; ++i)
+ assert(c.at(i) == i);
+ assert(c.front() == 0);
+ assert(c.back() == 9);
+ }
+#if __cplusplus >= 201103L
+ {
+ std::deque<int, min_allocator<int>> c = make<std::deque<int, min_allocator<int>> >(10);
for (unsigned i = 0; i < 10; ++i)
assert(c[i] == i);
for (unsigned i = 0; i < 10; ++i)
@@ -57,7 +79,7 @@ int main()
assert(c.back() == 9);
}
{
- const std::deque<int> c = make(10);
+ const std::deque<int, min_allocator<int>> c = make<std::deque<int, min_allocator<int>> >(10);
for (unsigned i = 0; i < 10; ++i)
assert(c[i] == i);
for (unsigned i = 0; i < 10; ++i)
@@ -65,4 +87,5 @@ int main()
assert(c.front() == 0);
assert(c.back() == 9);
}
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.capacity/resize_size.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.capacity/resize_size.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.capacity/resize_size.pass.cpp Sun Jun 23 16:17:24 2013
@@ -14,7 +14,10 @@
#include <deque>
#include <cassert>
-std::deque<int>
+#include "../../../min_allocator.h"
+
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -25,7 +28,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<int> c(init, 0);
+ C c(init, 0);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -35,11 +38,11 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void
-test(std::deque<int>& c1, int size)
+test(C& c1, int size)
{
- typedef std::deque<int> C;
- typedef C::const_iterator CI;
+ typedef typename C::const_iterator CI;
std::size_t c1_osize = c1.size();
c1.resize(size);
assert(c1.size() == size);
@@ -51,21 +54,33 @@ test(std::deque<int>& c1, int size)
assert(*i == 0);
}
+template <class C>
void
testN(int start, int N, int M)
{
- typedef std::deque<int> C;
- typedef C::const_iterator CI;
- C c1 = make(N, start);
+ typedef typename C::const_iterator CI;
+ C c1 = make<C>(N, start);
test(c1, M);
}
int main()
{
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int> >(rng[i], rng[j], rng[k]);
+ }
+#if __cplusplus >= 201103L
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
for (int k = 0; k < N; ++k)
- testN(rng[i], rng[j], rng[k]);
+ testN<std::deque<int, min_allocator<int>>>(rng[i], rng[j], rng[k]);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp Sun Jun 23 16:17:24 2013
@@ -14,7 +14,10 @@
#include <deque>
#include <cassert>
-std::deque<int>
+#include "../../../min_allocator.h"
+
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -25,7 +28,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<int> c(init, 0);
+ C c(init, 0);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -35,11 +38,11 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void
-test(std::deque<int>& c1, int size, int x)
+test(C& c1, int size, int x)
{
- typedef std::deque<int> C;
- typedef C::const_iterator CI;
+ typedef typename C::const_iterator CI;
std::size_t c1_osize = c1.size();
c1.resize(size, x);
assert(c1.size() == size);
@@ -51,21 +54,33 @@ test(std::deque<int>& c1, int size, int
assert(*i == x);
}
+template <class C>
void
testN(int start, int N, int M)
{
- typedef std::deque<int> C;
- typedef C::const_iterator CI;
- C c1 = make(N, start);
+ typedef typename C::const_iterator CI;
+ C c1 = make<C>(N, start);
test(c1, M, -10);
}
int main()
{
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int> >(rng[i], rng[j], rng[k]);
+ }
+#if __cplusplus >= 201103L
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
for (int k = 0; k < N; ++k)
- testN(rng[i], rng[j], rng[k]);
+ testN<std::deque<int, min_allocator<int>>>(rng[i], rng[j], rng[k]);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp Sun Jun 23 16:17:24 2013
@@ -14,7 +14,10 @@
#include <deque>
#include <cassert>
-std::deque<int>
+#include "../../../min_allocator.h"
+
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -25,7 +28,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<int> c(init, 0);
+ C c(init, 0);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -35,28 +38,40 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void
-test(std::deque<int>& c1)
+test(C& c1)
{
- std::deque<int> s = c1;
+ C s = c1;
c1.shrink_to_fit();
assert(c1 == s);
}
+template <class C>
void
testN(int start, int N)
{
- typedef std::deque<int> C;
- typedef C::const_iterator CI;
- C c1 = make(N, start);
+ typedef typename C::const_iterator CI;
+ C c1 = make<C>(N, start);
test(c1);
}
int main()
{
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
- testN(rng[i], rng[j]);
+ testN<std::deque<int> >(rng[i], rng[j]);
+ }
+#if __cplusplus >= 201103L
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.cons/alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.cons/alloc.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.cons/alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.cons/alloc.pass.cpp Sun Jun 23 16:17:24 2013
@@ -16,6 +16,7 @@
#include "../../../test_allocator.h"
#include "../../../NotConstructible.h"
+#include "../../../min_allocator.h"
template <class T, class Allocator>
void
@@ -30,4 +31,8 @@ int main()
{
test<int>(std::allocator<int>());
test<NotConstructible>(test_allocator<NotConstructible>(3));
+#if __cplusplus >= 201103L
+ test<int>(min_allocator<int>());
+ test<NotConstructible>(min_allocator<NotConstructible>{});
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp Sun Jun 23 16:17:24 2013
@@ -14,9 +14,12 @@
#include <deque>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
std::deque<int> d;
d.assign({3, 4, 5, 6});
assert(d.size() == 4);
@@ -24,5 +27,17 @@ int main()
assert(d[1] == 4);
assert(d[2] == 5);
assert(d[3] == 6);
+ }
+#if __cplusplus >= 201103L
+ {
+ std::deque<int, min_allocator<int>> d;
+ d.assign({3, 4, 5, 6});
+ assert(d.size() == 4);
+ assert(d[0] == 3);
+ assert(d[1] == 4);
+ assert(d[2] == 5);
+ assert(d[3] == 6);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp Sun Jun 23 16:17:24 2013
@@ -16,8 +16,10 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../../min_allocator.h"
-std::deque<int>
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -28,7 +30,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<int> c(init, 0);
+ C c(init, 0);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -38,8 +40,9 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void
-test(std::deque<int>& c1, const std::deque<int>& c2)
+test(C& c1, const C& c2)
{
std::size_t c1_osize = c1.size();
c1.assign(c2.begin(), c2.end());
@@ -47,22 +50,22 @@ test(std::deque<int>& c1, const std::deq
assert(c1 == c2);
}
+template <class C>
void
testN(int start, int N, int M)
{
- typedef std::deque<int> C;
- typedef C::iterator I;
- typedef C::const_iterator CI;
- C c1 = make(N, start);
- C c2 = make(M);
+ typedef typename C::iterator I;
+ typedef typename C::const_iterator CI;
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
test(c1, c2);
}
+template <class C>
void
-testI(std::deque<int>& c1, const std::deque<int>& c2)
+testI(C& c1, const C& c2)
{
- typedef std::deque<int> C;
- typedef C::const_iterator CI;
+ typedef typename C::const_iterator CI;
typedef input_iterator<CI> ICI;
std::size_t c1_osize = c1.size();
c1.assign(ICI(c2.begin()), ICI(c2.end()));
@@ -70,24 +73,37 @@ testI(std::deque<int>& c1, const std::de
assert(c1 == c2);
}
+template <class C>
void
testNI(int start, int N, int M)
{
- typedef std::deque<int> C;
- typedef C::iterator I;
- typedef C::const_iterator CI;
- C c1 = make(N, start);
- C c2 = make(M);
+ typedef typename C::iterator I;
+ typedef typename C::const_iterator CI;
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
testI(c1, c2);
}
int main()
{
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
for (int k = 0; k < N; ++k)
- testN(rng[i], rng[j], rng[k]);
- testNI(1500, 2000, 1000);
+ testN<std::deque<int> >(rng[i], rng[j], rng[k]);
+ testNI<std::deque<int> >(1500, 2000, 1000);
+ }
+#if __cplusplus >= 201103L
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j], rng[k]);
+ testNI<std::deque<int, min_allocator<int>> >(1500, 2000, 1000);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp Sun Jun 23 16:17:24 2013
@@ -15,8 +15,10 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../../min_allocator.h"
-std::deque<int>
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -27,7 +29,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<int> c(init, 0);
+ C c(init, 0);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -37,11 +39,11 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void
-test(std::deque<int>& c1, int size, int v)
+test(C& c1, int size, int v)
{
- typedef std::deque<int> C;
- typedef C::const_iterator CI;
+ typedef typename C::const_iterator CI;
std::size_t c1_osize = c1.size();
c1.assign(size, v);
assert(c1.size() == size);
@@ -50,22 +52,34 @@ test(std::deque<int>& c1, int size, int
assert(*i == v);
}
+template <class C>
void
testN(int start, int N, int M)
{
- typedef std::deque<int> C;
- typedef C::iterator I;
- typedef C::const_iterator CI;
- C c1 = make(N, start);
+ typedef typename C::iterator I;
+ typedef typename C::const_iterator CI;
+ C c1 = make<C>(N, start);
test(c1, M, -10);
}
int main()
{
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
for (int k = 0; k < N; ++k)
- testN(rng[i], rng[j], rng[k]);
+ testN<std::deque<int> >(rng[i], rng[j], rng[k]);
+ }
+#if __cplusplus >= 201103L
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j], rng[k]);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.cons/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.cons/copy.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.cons/copy.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.cons/copy.pass.cpp Sun Jun 23 16:17:24 2013
@@ -14,6 +14,7 @@
#include <deque>
#include <cassert>
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
template <class C>
void
@@ -44,4 +45,17 @@ int main()
assert(v2.get_allocator() == other_allocator<int>(-2));
}
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if __cplusplus >= 201103L
+ {
+ 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(std::deque<int, min_allocator<int>>(ab, an));
+ }
+ {
+ std::deque<int, min_allocator<int> > v(3, 2, min_allocator<int>());
+ std::deque<int, min_allocator<int> > v2 = v;
+ assert(v2 == v);
+ assert(v2.get_allocator() == v.get_allocator());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp Sun Jun 23 16:17:24 2013
@@ -15,6 +15,7 @@
#include <cassert>
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
template <class C>
void
@@ -39,4 +40,12 @@ int main()
test(std::deque<int, other_allocator<int> >(ab, an, other_allocator<int>(3)),
other_allocator<int>(4));
}
+#if __cplusplus >= 201103L
+ {
+ 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(std::deque<int, min_allocator<int> >(ab, an, min_allocator<int>()),
+ min_allocator<int>());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.cons/default.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.cons/default.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.cons/default.pass.cpp Sun Jun 23 16:17:24 2013
@@ -16,6 +16,7 @@
#include "../../../stack_allocator.h"
#include "../../../NotConstructible.h"
+#include "../../../min_allocator.h"
template <class T, class Allocator>
void
@@ -29,4 +30,8 @@ int main()
{
test<int, std::allocator<int> >();
test<NotConstructible, stack_allocator<NotConstructible, 1> >();
+#if __cplusplus >= 201103L
+ test<int, min_allocator<int> >();
+ test<NotConstructible, min_allocator<NotConstructible> >();
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.cons/initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.cons/initializer_list.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.cons/initializer_list.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.cons/initializer_list.pass.cpp Sun Jun 23 16:17:24 2013
@@ -14,14 +14,28 @@
#include <deque>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
std::deque<int> d = {3, 4, 5, 6};
assert(d.size() == 4);
assert(d[0] == 3);
assert(d[1] == 4);
assert(d[2] == 5);
assert(d[3] == 6);
+ }
+#if __cplusplus >= 201103L
+ {
+ std::deque<int, min_allocator<int>> d = {3, 4, 5, 6};
+ assert(d.size() == 4);
+ assert(d[0] == 3);
+ assert(d[1] == 4);
+ assert(d[2] == 5);
+ assert(d[3] == 6);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp Sun Jun 23 16:17:24 2013
@@ -15,10 +15,12 @@
#include <cassert>
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
std::deque<int, test_allocator<int>> d({3, 4, 5, 6}, test_allocator<int>(3));
assert(d.get_allocator() == test_allocator<int>(3));
assert(d.size() == 4);
@@ -26,5 +28,17 @@ int main()
assert(d[1] == 4);
assert(d[2] == 5);
assert(d[3] == 6);
+ }
+#if __cplusplus >= 201103L
+ {
+ std::deque<int, min_allocator<int>> d({3, 4, 5, 6}, min_allocator<int>());
+ assert(d.get_allocator() == min_allocator<int>());
+ assert(d.size() == 4);
+ assert(d[0] == 3);
+ assert(d[1] == 4);
+ assert(d[2] == 5);
+ assert(d[3] == 6);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.cons/iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.cons/iter_iter.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.cons/iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.cons/iter_iter.pass.cpp Sun Jun 23 16:17:24 2013
@@ -16,6 +16,7 @@
#include "../../../stack_allocator.h"
#include "test_iterators.h"
+#include "../../../min_allocator.h"
template <class InputIterator>
void
@@ -55,4 +56,7 @@ int main()
test(bidirectional_iterator<const int*>(ab), bidirectional_iterator<const int*>(an));
test(random_access_iterator<const int*>(ab), random_access_iterator<const int*>(an));
test<stack_allocator<int, 4096> >(ab, an);
+#if __cplusplus >= 201103L
+ test<min_allocator<int> >(ab, an);
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp Sun Jun 23 16:17:24 2013
@@ -17,6 +17,7 @@
#include "test_iterators.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
template <class InputIterator, class Allocator>
void
@@ -41,4 +42,10 @@ int main()
test(forward_iterator<const int*>(ab), forward_iterator<const int*>(an), test_allocator<int>(4));
test(bidirectional_iterator<const int*>(ab), bidirectional_iterator<const int*>(an), test_allocator<int>(5));
test(random_access_iterator<const int*>(ab), random_access_iterator<const int*>(an), test_allocator<int>(6));
+#if __cplusplus >= 201103L
+ test(input_iterator<const int*>(ab), input_iterator<const int*>(an), min_allocator<int>());
+ test(forward_iterator<const int*>(ab), forward_iterator<const int*>(an), min_allocator<int>());
+ test(bidirectional_iterator<const int*>(ab), bidirectional_iterator<const int*>(an), min_allocator<int>());
+ test(random_access_iterator<const int*>(ab), random_access_iterator<const int*>(an), min_allocator<int>());
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.cons/move.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.cons/move.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.cons/move.pass.cpp Sun Jun 23 16:17:24 2013
@@ -16,6 +16,7 @@
#include "../../../MoveOnly.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -50,5 +51,22 @@ int main()
assert(c1.size() == 0);
assert(c3.get_allocator() == c1.get_allocator());
}
+#if __cplusplus >= 201103L
+ {
+ 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]);
+ typedef min_allocator<MoveOnly> A;
+ std::deque<MoveOnly, A> c1(A{});
+ for (int* p = ab; p < an; ++p)
+ c1.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c2(A{});
+ for (int* p = ab; p < an; ++p)
+ c2.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c3 = std::move(c1);
+ assert(c2 == c3);
+ assert(c1.size() == 0);
+ assert(c3.get_allocator() == c1.get_allocator());
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.cons/move_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.cons/move_alloc.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.cons/move_alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.cons/move_alloc.pass.cpp Sun Jun 23 16:17:24 2013
@@ -16,6 +16,7 @@
#include "../../../MoveOnly.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -65,5 +66,22 @@ int main()
assert(c3.get_allocator() == A(3));
assert(c1.size() != 0);
}
+#if __cplusplus >= 201103L
+ {
+ 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]);
+ typedef min_allocator<MoveOnly> A;
+ std::deque<MoveOnly, A> c1(A{});
+ for (int* p = ab; p < an; ++p)
+ c1.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c2(A{});
+ for (int* p = ab; p < an; ++p)
+ c2.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c3(std::move(c1), A());
+ assert(c2 == c3);
+ assert(c3.get_allocator() == A());
+ assert(c1.size() == 0);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.cons/move_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.cons/move_assign.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.cons/move_assign.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.cons/move_assign.pass.cpp Sun Jun 23 16:17:24 2013
@@ -16,6 +16,7 @@
#include "../../../MoveOnly.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -68,5 +69,23 @@ int main()
assert(c1.size() == 0);
assert(c3.get_allocator() == A(5));
}
+#if __cplusplus >= 201103L
+ {
+ 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]);
+ typedef min_allocator<MoveOnly> A;
+ std::deque<MoveOnly, A> c1(A{});
+ for (int* p = ab; p < an; ++p)
+ c1.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c2(A{});
+ for (int* p = ab; p < an; ++p)
+ c2.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c3(A{});
+ c3 = std::move(c1);
+ assert(c2 == c3);
+ assert(c1.size() == 0);
+ assert(c3.get_allocator() == A());
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.cons/op_equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.cons/op_equal.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.cons/op_equal.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.cons/op_equal.pass.cpp Sun Jun 23 16:17:24 2013
@@ -14,6 +14,7 @@
#include <deque>
#include <cassert>
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
template <class C>
void
@@ -45,4 +46,18 @@ int main()
assert(l2 == l);
assert(l2.get_allocator() == other_allocator<int>(5));
}
+#if __cplusplus >= 201103L
+ {
+ 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(std::deque<int, min_allocator<int>>(ab, an));
+ }
+ {
+ std::deque<int, min_allocator<int> > l(3, 2, min_allocator<int>());
+ std::deque<int, min_allocator<int> > l2(l, min_allocator<int>());
+ l2 = l;
+ assert(l2 == l);
+ assert(l2.get_allocator() == min_allocator<int>());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp Sun Jun 23 16:17:24 2013
@@ -14,9 +14,12 @@
#include <deque>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
std::deque<int> d;
d = {3, 4, 5, 6};
assert(d.size() == 4);
@@ -24,5 +27,17 @@ int main()
assert(d[1] == 4);
assert(d[2] == 5);
assert(d[3] == 6);
+ }
+#if __cplusplus >= 201103L
+ {
+ std::deque<int, min_allocator<int>> d;
+ d = {3, 4, 5, 6};
+ assert(d.size() == 4);
+ assert(d[0] == 3);
+ assert(d[1] == 4);
+ assert(d[2] == 5);
+ assert(d[3] == 6);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.cons/size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.cons/size.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.cons/size.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.cons/size.pass.cpp Sun Jun 23 16:17:24 2013
@@ -16,6 +16,7 @@
#include "../../../stack_allocator.h"
#include "../../../DefaultOnly.h"
+#include "../../../min_allocator.h"
template <class T, class Allocator>
void
@@ -52,4 +53,7 @@ int main()
test<DefaultOnly, std::allocator<DefaultOnly> >(4096);
test<DefaultOnly, std::allocator<DefaultOnly> >(4097);
test<DefaultOnly, stack_allocator<DefaultOnly, 4096> >(4095);
+#if __cplusplus >= 201103L
+ test<DefaultOnly, min_allocator<DefaultOnly> >(4095);
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.cons/size_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.cons/size_value.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.cons/size_value.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.cons/size_value.pass.cpp Sun Jun 23 16:17:24 2013
@@ -15,6 +15,7 @@
#include <cassert>
#include "../../../stack_allocator.h"
+#include "../../../min_allocator.h"
template <class T, class Allocator>
void
@@ -44,4 +45,7 @@ int main()
test<int, std::allocator<int> >(4096, 1165);
test<int, std::allocator<int> >(4097, 157);
test<int, stack_allocator<int, 4096> >(4095, 90);
+#if __cplusplus >= 201103L
+ test<int, min_allocator<int> >(4095, 90);
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp Sun Jun 23 16:17:24 2013
@@ -14,6 +14,8 @@
#include <deque>
#include <cassert>
+#include "../../../min_allocator.h"
+
template <class T, class Allocator>
void
test(unsigned n, const T& x, const Allocator& a)
@@ -30,6 +32,7 @@ test(unsigned n, const T& x, const Alloc
int main()
{
+ {
std::allocator<int> a;
test(0, 5, a);
test(1, 10, a);
@@ -43,4 +46,22 @@ int main()
test(4095, 78, a);
test(4096, 1165, a);
test(4097, 157, a);
+ }
+#if __cplusplus >= 201103L
+ {
+ min_allocator<int> a;
+ test(0, 5, a);
+ test(1, 10, a);
+ test(10, 11, a);
+ test(1023, -11, a);
+ test(1024, 25, a);
+ test(1025, 0, a);
+ test(2047, 110, a);
+ test(2048, -500, a);
+ test(2049, 654, a);
+ test(4095, 78, a);
+ test(4096, 1165, a);
+ test(4097, 157, a);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.modifiers/emplace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.modifiers/emplace.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.modifiers/emplace.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.modifiers/emplace.pass.cpp Sun Jun 23 16:17:24 2013
@@ -15,10 +15,12 @@
#include <cassert>
#include "../../../Emplaceable.h"
+#include "../../../min_allocator.h"
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-std::deque<Emplaceable>
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -29,7 +31,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<Emplaceable> c(init);
+ C c(init);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -39,12 +41,12 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void
-test(int P, std::deque<Emplaceable>& c1)
+test(int P, C& c1)
{
- typedef std::deque<Emplaceable> C;
- typedef C::iterator I;
- typedef C::const_iterator CI;
+ typedef typename C::iterator I;
+ typedef typename C::const_iterator CI;
std::size_t c1_osize = c1.size();
CI i = c1.emplace(c1.begin() + P, Emplaceable(1, 2.5));
assert(i == c1.begin() + P);
@@ -53,17 +55,17 @@ test(int P, std::deque<Emplaceable>& c1)
assert(*i == Emplaceable(1, 2.5));
}
+template <class C>
void
testN(int start, int N)
{
- typedef std::deque<Emplaceable> C;
- typedef C::iterator I;
- typedef C::const_iterator CI;
+ typedef typename C::iterator I;
+ typedef typename C::const_iterator CI;
for (int i = 0; i <= 3; ++i)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
+ C c1 = make<C>(N, start);
test(i, c1);
}
}
@@ -71,7 +73,7 @@ testN(int start, int N)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
+ C c1 = make<C>(N, start);
test(i, c1);
}
}
@@ -79,7 +81,7 @@ testN(int start, int N)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
+ C c1 = make<C>(N, start);
test(i, c1);
}
}
@@ -90,10 +92,21 @@ testN(int start, int N)
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<Emplaceable> >(rng[i], rng[j]);
+ }
+#if __cplusplus >= 201103L
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
- testN(rng[i], rng[j]);
+ testN<std::deque<Emplaceable, min_allocator<Emplaceable>> >(rng[i], rng[j]);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp Sun Jun 23 16:17:24 2013
@@ -15,10 +15,12 @@
#include <cassert>
#include "../../../Emplaceable.h"
+#include "../../../min_allocator.h"
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-std::deque<Emplaceable>
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -29,7 +31,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<Emplaceable> c(init);
+ C c(init);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -39,11 +41,11 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void
-test(std::deque<Emplaceable>& c1)
+test(C& c1)
{
- typedef std::deque<Emplaceable> C;
- typedef C::iterator I;
+ typedef typename C::iterator I;
std::size_t c1_osize = c1.size();
c1.emplace_back(Emplaceable(1, 2.5));
assert(c1.size() == c1_osize + 1);
@@ -52,11 +54,11 @@ test(std::deque<Emplaceable>& c1)
assert(*--i == Emplaceable(1, 2.5));
}
+template <class C>
void
testN(int start, int N)
{
- typedef std::deque<Emplaceable> C;
- C c1 = make(N, start);
+ C c1 = make<C>(N, start);
test(c1);
}
@@ -65,10 +67,21 @@ testN(int start, int N)
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<Emplaceable> >(rng[i], rng[j]);
+ }
+#if __cplusplus >= 201103L
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
- testN(rng[i], rng[j]);
+ testN<std::deque<Emplaceable, min_allocator<Emplaceable>> >(rng[i], rng[j]);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp Sun Jun 23 16:17:24 2013
@@ -15,10 +15,12 @@
#include <cassert>
#include "../../../Emplaceable.h"
+#include "../../../min_allocator.h"
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-std::deque<Emplaceable>
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -29,7 +31,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<Emplaceable> c(init);
+ C c(init);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -39,11 +41,11 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void
-test(std::deque<Emplaceable>& c1)
+test(C& c1)
{
- typedef std::deque<Emplaceable> C;
- typedef C::iterator I;
+ typedef typename C::iterator I;
std::size_t c1_osize = c1.size();
c1.emplace_front(Emplaceable(1, 2.5));
assert(c1.size() == c1_osize + 1);
@@ -52,11 +54,11 @@ test(std::deque<Emplaceable>& c1)
assert(*i == Emplaceable(1, 2.5));
}
+template <class C>
void
testN(int start, int N)
{
- typedef std::deque<Emplaceable> C;
- C c1 = make(N, start);
+ C c1 = make<C>(N, start);
test(c1);
}
@@ -65,10 +67,21 @@ testN(int start, int N)
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<Emplaceable> >(rng[i], rng[j]);
+ }
+#if __cplusplus >= 201103L
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
- testN(rng[i], rng[j]);
+ testN<std::deque<Emplaceable, min_allocator<Emplaceable>> >(rng[i], rng[j]);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp Sun Jun 23 16:17:24 2013
@@ -14,7 +14,10 @@
#include <deque>
#include <cassert>
-std::deque<int>
+#include "../../../min_allocator.h"
+
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -25,7 +28,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<int> c(init, 0);
+ C c(init, 0);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -35,11 +38,11 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void
-test(int P, std::deque<int>& c1)
+test(int P, C& c1)
{
- typedef std::deque<int> C;
- typedef C::iterator I;
+ typedef typename C::iterator I;
assert(P < c1.size());
std::size_t c1_osize = c1.size();
I i = c1.erase(c1.cbegin() + P);
@@ -54,23 +57,34 @@ test(int P, std::deque<int>& c1)
assert(*i == j);
}
+template <class C>
void
testN(int start, int N)
{
- typedef std::deque<int> C;
int pstep = std::max(N / std::max(std::min(N, 10), 1), 1);
for (int p = 0; p < N; p += pstep)
{
- C c1 = make(N, start);
+ C c1 = make<C>(N, start);
test(p, c1);
}
}
int main()
{
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
- testN(rng[i], rng[j]);
+ testN<std::deque<int> >(rng[i], rng[j]);
+ }
+#if __cplusplus >= 201103L
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp Sun Jun 23 16:17:24 2013
@@ -14,7 +14,10 @@
#include <deque>
#include <cassert>
-std::deque<int>
+#include "../../../min_allocator.h"
+
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -25,7 +28,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<int> c(init, 0);
+ C c(init, 0);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -35,11 +38,11 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void
-test(int P, std::deque<int>& c1, int size)
+test(int P, C& c1, int size)
{
- typedef std::deque<int> C;
- typedef C::iterator I;
+ typedef typename C::iterator I;
assert(P + size <= c1.size());
std::size_t c1_osize = c1.size();
I i = c1.erase(c1.cbegin() + P, c1.cbegin() + (P + size));
@@ -54,17 +57,17 @@ test(int P, std::deque<int>& c1, int siz
assert(*i == j);
}
+template <class C>
void
testN(int start, int N)
{
- typedef std::deque<int> C;
int pstep = std::max(N / std::max(std::min(N, 10), 1), 1);
for (int p = 0; p <= N; p += pstep)
{
int sstep = std::max((N - p) / std::max(std::min(N - p, 10), 1), 1);
for (int s = 0; s <= N - p; s += sstep)
{
- C c1 = make(N, start);
+ C c1 = make<C>(N, start);
test(p, c1, s);
}
}
@@ -72,9 +75,20 @@ testN(int start, int N)
int main()
{
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
- testN(rng[i], rng[j]);
+ testN<std::deque<int> >(rng[i], rng[j]);
+ }
+#if __cplusplus >= 201103L
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp Sun Jun 23 16:17:24 2013
@@ -14,9 +14,12 @@
#include <deque>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
std::deque<int> d(10, 1);
std::deque<int>::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6});
assert(d.size() == 14);
@@ -35,5 +38,26 @@ int main()
assert(d[11] == 1);
assert(d[12] == 1);
assert(d[13] == 1);
+ }
+ {
+ std::deque<int, min_allocator<int>> d(10, 1);
+ std::deque<int, min_allocator<int>>::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6});
+ assert(d.size() == 14);
+ assert(i == d.begin() + 2);
+ assert(d[0] == 1);
+ assert(d[1] == 1);
+ assert(d[2] == 3);
+ assert(d[3] == 4);
+ assert(d[4] == 5);
+ assert(d[5] == 6);
+ assert(d[6] == 1);
+ assert(d[7] == 1);
+ assert(d[8] == 1);
+ assert(d[9] == 1);
+ assert(d[10] == 1);
+ assert(d[11] == 1);
+ assert(d[12] == 1);
+ assert(d[13] == 1);
+ }
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp Sun Jun 23 16:17:24 2013
@@ -18,8 +18,10 @@
#include "test_iterators.h"
#include "../../../MoveOnly.h"
#include "../../../stack_allocator.h"
+#include "../../../min_allocator.h"
-std::deque<int>
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -30,7 +32,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<int> c(init, 0);
+ C c(init, 0);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -40,12 +42,12 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void
-test(int P, std::deque<int>& c1, const std::deque<int>& c2)
+test(int P, C& c1, const C& c2)
{
- typedef std::deque<int> C;
- typedef C::iterator I;
- typedef C::const_iterator CI;
+ typedef typename C::iterator I;
+ typedef typename C::const_iterator CI;
typedef bidirectional_iterator<CI> BCI;
std::size_t c1_osize = c1.size();
CI i = c1.insert(c1.begin() + P, BCI(c2.begin()), BCI(c2.end()));
@@ -61,18 +63,18 @@ test(int P, std::deque<int>& c1, const s
assert(*i == j);
}
+template <class C>
void
testN(int start, int N, int M)
{
- typedef std::deque<int> C;
- typedef C::iterator I;
- typedef C::const_iterator CI;
+ typedef typename C::iterator I;
+ typedef typename C::const_iterator CI;
for (int i = 0; i <= 3; ++i)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
- C c2 = make(M);
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
test(i, c1, c2);
}
}
@@ -80,8 +82,8 @@ testN(int start, int N, int M)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
- C c2 = make(M);
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
test(i, c1, c2);
}
}
@@ -89,8 +91,8 @@ testN(int start, int N, int M)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
- C c2 = make(M);
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
test(i, c1, c2);
}
}
@@ -98,8 +100,8 @@ testN(int start, int N, int M)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
- C c2 = make(M);
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
test(i, c1, c2);
}
}
@@ -107,8 +109,8 @@ testN(int start, int N, int M)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
- C c2 = make(M);
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
test(i, c1, c2);
}
}
@@ -116,19 +118,19 @@ testN(int start, int N, int M)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
- C c2 = make(M);
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
test(i, c1, c2);
}
}
}
+template <class C>
void
-testI(int P, std::deque<int>& c1, const std::deque<int>& c2)
+testI(int P, C& c1, const C& c2)
{
- typedef std::deque<int> C;
- typedef C::iterator I;
- typedef C::const_iterator CI;
+ typedef typename C::iterator I;
+ typedef typename C::const_iterator CI;
typedef input_iterator<CI> ICI;
std::size_t c1_osize = c1.size();
CI i = c1.insert(c1.begin() + P, ICI(c2.begin()), ICI(c2.end()));
@@ -144,18 +146,18 @@ testI(int P, std::deque<int>& c1, const
assert(*i == j);
}
+template <class C>
void
testNI(int start, int N, int M)
{
- typedef std::deque<int> C;
- typedef C::iterator I;
- typedef C::const_iterator CI;
+ typedef typename C::iterator I;
+ typedef typename C::const_iterator CI;
for (int i = 0; i <= 3; ++i)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
- C c2 = make(M);
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
testI(i, c1, c2);
}
}
@@ -163,8 +165,8 @@ testNI(int start, int N, int M)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
- C c2 = make(M);
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
testI(i, c1, c2);
}
}
@@ -172,8 +174,8 @@ testNI(int start, int N, int M)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
- C c2 = make(M);
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
testI(i, c1, c2);
}
}
@@ -181,8 +183,8 @@ testNI(int start, int N, int M)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
- C c2 = make(M);
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
testI(i, c1, c2);
}
}
@@ -190,19 +192,20 @@ testNI(int start, int N, int M)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
- C c2 = make(M);
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
testI(i, c1, c2);
}
}
}
+template <class C>
void
test_move()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- std::deque<MoveOnly, stack_allocator<MoveOnly, 2000> > c;
- typedef std::deque<MoveOnly>::const_iterator CI;
+ C c;
+ typedef typename C::const_iterator CI;
{
MoveOnly mo(0);
typedef MoveOnly* I;
@@ -224,12 +227,28 @@ test_move()
int main()
{
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
for (int k = 0; k < N; ++k)
- testN(rng[i], rng[j], rng[k]);
- testNI(1500, 2000, 1000);
- test_move();
+ testN<std::deque<int> >(rng[i], rng[j], rng[k]);
+ testNI<std::deque<int> >(1500, 2000, 1000);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ test_move<std::deque<MoveOnly, stack_allocator<MoveOnly, 2000> > >();
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ }
+#if __cplusplus >= 201103L
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j], rng[k]);
+ testNI<std::deque<int> >(1500, 2000, 1000);
+ test_move<std::deque<MoveOnly, min_allocator<MoveOnly> > >();
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp Sun Jun 23 16:17:24 2013
@@ -15,10 +15,12 @@
#include <cassert>
#include "../../../MoveOnly.h"
+#include "../../../min_allocator.h"
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-std::deque<MoveOnly>
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -29,7 +31,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<MoveOnly> c(init);
+ C c(init);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -39,12 +41,12 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void
-test(int P, std::deque<MoveOnly>& c1, int x)
+test(int P, C& c1, int x)
{
- typedef std::deque<MoveOnly> C;
- typedef C::iterator I;
- typedef C::const_iterator CI;
+ typedef typename C::iterator I;
+ typedef typename C::const_iterator CI;
std::size_t c1_osize = c1.size();
CI i = c1.insert(c1.begin() + P, MoveOnly(x));
assert(i == c1.begin() + P);
@@ -59,17 +61,17 @@ test(int P, std::deque<MoveOnly>& c1, in
assert(*i == MoveOnly(j));
}
+template <class C>
void
testN(int start, int N)
{
- typedef std::deque<MoveOnly> C;
- typedef C::iterator I;
- typedef C::const_iterator CI;
+ typedef typename C::iterator I;
+ typedef typename C::const_iterator CI;
for (int i = 0; i <= 3; ++i)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
+ C c1 = make<C>(N, start);
test(i, c1, -10);
}
}
@@ -77,7 +79,7 @@ testN(int start, int N)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
+ C c1 = make<C>(N, start);
test(i, c1, -10);
}
}
@@ -85,7 +87,7 @@ testN(int start, int N)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
+ C c1 = make<C>(N, start);
test(i, c1, -10);
}
}
@@ -96,10 +98,21 @@ testN(int start, int N)
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<MoveOnly> >(rng[i], rng[j]);
+ }
+#if __cplusplus >= 201103L
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
- testN(rng[i], rng[j]);
+ testN<std::deque<MoveOnly, min_allocator<MoveOnly>> >(rng[i], rng[j]);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp Sun Jun 23 16:17:24 2013
@@ -14,7 +14,10 @@
#include <deque>
#include <cassert>
-std::deque<int>
+#include "../../../min_allocator.h"
+
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -25,7 +28,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<int> c(init, 0);
+ C c(init, 0);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -35,12 +38,12 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void
-test(int P, std::deque<int>& c1, int size, int x)
+test(int P, C& c1, int size, int x)
{
- typedef std::deque<int> C;
- typedef C::iterator I;
- typedef C::const_iterator CI;
+ typedef typename C::iterator I;
+ typedef typename C::const_iterator CI;
std::size_t c1_osize = c1.size();
CI i = c1.insert(c1.begin() + P, size, x);
assert(i == c1.begin() + P);
@@ -55,17 +58,17 @@ test(int P, std::deque<int>& c1, int siz
assert(*i == j);
}
+template <class C>
void
testN(int start, int N, int M)
{
- typedef std::deque<int> C;
- typedef C::iterator I;
- typedef C::const_iterator CI;
+ typedef typename C::iterator I;
+ typedef typename C::const_iterator CI;
for (int i = 0; i <= 3; ++i)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
+ C c1 = make<C>(N, start);
test(i, c1, M, -10);
}
}
@@ -73,7 +76,7 @@ testN(int start, int N, int M)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
+ C c1 = make<C>(N, start);
test(i, c1, M, -10);
}
}
@@ -81,7 +84,7 @@ testN(int start, int N, int M)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
+ C c1 = make<C>(N, start);
test(i, c1, M, -10);
}
}
@@ -89,7 +92,7 @@ testN(int start, int N, int M)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
+ C c1 = make<C>(N, start);
test(i, c1, M, -10);
}
}
@@ -97,22 +100,22 @@ testN(int start, int N, int M)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
+ C c1 = make<C>(N, start);
test(i, c1, M, -10);
}
}
}
+template <class C>
void
self_reference_test()
{
- typedef std::deque<int> C;
- typedef C::const_iterator CI;
+ typedef typename C::const_iterator CI;
for (int i = 0; i < 20; ++i)
{
for (int j = 0; j < 20; ++j)
{
- C c = make(20);
+ C c = make<C>(20);
CI it = c.cbegin() + i;
CI jt = c.cbegin() + j;
c.insert(it, 5, *jt);
@@ -131,11 +134,24 @@ self_reference_test()
int main()
{
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int> >(rng[i], rng[j], rng[k]);
+ self_reference_test<std::deque<int> >();
+ }
+#if __cplusplus >= 201103L
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
for (int k = 0; k < N; ++k)
- testN(rng[i], rng[j], rng[k]);
- self_reference_test();
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j], rng[k]);
+ self_reference_test<std::deque<int, min_allocator<int>> >();
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp Sun Jun 23 16:17:24 2013
@@ -14,7 +14,10 @@
#include <deque>
#include <cassert>
-std::deque<int>
+#include "../../../min_allocator.h"
+
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -25,7 +28,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<int> c(init, 0);
+ C c(init, 0);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -35,12 +38,12 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void
-test(int P, std::deque<int>& c1, int x)
+test(int P, C& c1, int x)
{
- typedef std::deque<int> C;
- typedef C::iterator I;
- typedef C::const_iterator CI;
+ typedef typename C::iterator I;
+ typedef typename C::const_iterator CI;
std::size_t c1_osize = c1.size();
CI i = c1.insert(c1.begin() + P, x);
assert(i == c1.begin() + P);
@@ -55,17 +58,17 @@ test(int P, std::deque<int>& c1, int x)
assert(*i == j);
}
+template <class C>
void
testN(int start, int N)
{
- typedef std::deque<int> C;
- typedef C::iterator I;
- typedef C::const_iterator CI;
+ typedef typename C::iterator I;
+ typedef typename C::const_iterator CI;
for (int i = 0; i <= 3; ++i)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
+ C c1 = make<C>(N, start);
test(i, c1, -10);
}
}
@@ -73,7 +76,7 @@ testN(int start, int N)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
+ C c1 = make<C>(N, start);
test(i, c1, -10);
}
}
@@ -81,22 +84,22 @@ testN(int start, int N)
{
if (0 <= i && i <= N)
{
- C c1 = make(N, start);
+ C c1 = make<C>(N, start);
test(i, c1, -10);
}
}
}
+template <class C>
void
self_reference_test()
{
- typedef std::deque<int> C;
- typedef C::const_iterator CI;
+ typedef typename C::const_iterator CI;
for (int i = 0; i < 20; ++i)
{
for (int j = 0; j < 20; ++j)
{
- C c = make(20);
+ C c = make<C>(20);
CI it = c.cbegin() + i;
CI jt = c.cbegin() + j;
c.insert(it, *jt);
@@ -115,10 +118,22 @@ self_reference_test()
int main()
{
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
- testN(rng[i], rng[j]);
- self_reference_test();
+ testN<std::deque<int> >(rng[i], rng[j]);
+ self_reference_test<std::deque<int> >();
+ }
+#if __cplusplus >= 201103L
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+ self_reference_test<std::deque<int, min_allocator<int>> >();
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp Sun Jun 23 16:17:24 2013
@@ -14,7 +14,10 @@
#include <deque>
#include <cassert>
-std::deque<int>
+#include "../../../min_allocator.h"
+
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -25,7 +28,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<int> c(init, 0);
+ C c(init, 0);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -35,11 +38,11 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void
-test(std::deque<int>& c1)
+test(C& c1)
{
- typedef std::deque<int> C;
- typedef C::iterator I;
+ typedef typename C::iterator I;
std::size_t c1_osize = c1.size();
c1.pop_back();
assert(c1.size() == c1_osize - 1);
@@ -49,22 +52,33 @@ test(std::deque<int>& c1)
assert(*i == j);
}
+template <class C>
void
testN(int start, int N)
{
if (N != 0)
{
- typedef std::deque<int> C;
- C c1 = make(N, start);
+ C c1 = make<C>(N, start);
test(c1);
}
}
int main()
{
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
- testN(rng[i], rng[j]);
+ testN<std::deque<int> >(rng[i], rng[j]);
+ }
+#if __cplusplus >= 201103L
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp Sun Jun 23 16:17:24 2013
@@ -14,7 +14,10 @@
#include <deque>
#include <cassert>
-std::deque<int>
+#include "../../../min_allocator.h"
+
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -25,7 +28,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<int> c(init, 0);
+ C c(init, 0);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -35,11 +38,11 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void
-test(std::deque<int>& c1)
+test(C& c1)
{
- typedef std::deque<int> C;
- typedef C::iterator I;
+ typedef typename C::iterator I;
std::size_t c1_osize = c1.size();
c1.pop_front();
assert(c1.size() == c1_osize - 1);
@@ -49,22 +52,33 @@ test(std::deque<int>& c1)
assert(*i == j);
}
+template <class C>
void
testN(int start, int N)
{
if (N != 0)
{
- typedef std::deque<int> C;
- C c1 = make(N, start);
+ C c1 = make<C>(N, start);
test(c1);
}
}
int main()
{
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
- testN(rng[i], rng[j]);
+ testN<std::deque<int> >(rng[i], rng[j]);
+ }
+#if __cplusplus >= 201103L
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.modifiers/push_back.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.modifiers/push_back.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.modifiers/push_back.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.modifiers/push_back.pass.cpp Sun Jun 23 16:17:24 2013
@@ -16,7 +16,10 @@
#include <deque>
#include <cassert>
-std::deque<int>
+#include "../../../min_allocator.h"
+
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -27,7 +30,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<int> c(init, 0);
+ C c(init, 0);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -37,14 +40,15 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void test(int size)
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int j = 0; j < N; ++j)
{
- std::deque<int> c = make(size, rng[j]);
- std::deque<int>::const_iterator it = c.begin();
+ C c = make<C>(size, rng[j]);
+ typename C::const_iterator it = c.begin();
for (int i = 0; i < size; ++i, ++it)
assert(*it == i);
}
@@ -52,8 +56,18 @@ void test(int size)
int main()
{
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int j = 0; j < N; ++j)
+ test<std::deque<int> >(rng[j]);
+ }
+#if __cplusplus >= 201103L
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int j = 0; j < N; ++j)
- test(rng[j]);
+ test<std::deque<int, min_allocator<int>> >(rng[j]);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp Sun Jun 23 16:17:24 2013
@@ -17,10 +17,12 @@
#include <cassert>
#include "../../../MoveOnly.h"
+#include "../../../min_allocator.h"
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-std::deque<MoveOnly>
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -31,7 +33,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<MoveOnly> c(init);
+ C c(init);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -41,14 +43,15 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void test(int size)
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int j = 0; j < N; ++j)
{
- std::deque<MoveOnly> c = make(size, rng[j]);
- std::deque<MoveOnly>::const_iterator it = c.begin();
+ C c = make<C>(size, rng[j]);
+ typename C::const_iterator it = c.begin();
for (int i = 0; i < size; ++i, ++it)
assert(*it == MoveOnly(i));
}
@@ -59,9 +62,19 @@ void test(int size)
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int j = 0; j < N; ++j)
- test(rng[j]);
+ test<std::deque<MoveOnly> >(rng[j]);
+ }
+#if __cplusplus >= 201103L
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int j = 0; j < N; ++j)
+ test<std::deque<MoveOnly, min_allocator<MoveOnly>> >(rng[j]);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.modifiers/push_front.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.modifiers/push_front.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.modifiers/push_front.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.modifiers/push_front.pass.cpp Sun Jun 23 16:17:24 2013
@@ -14,7 +14,10 @@
#include <deque>
#include <cassert>
-std::deque<int>
+#include "../../../min_allocator.h"
+
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -25,7 +28,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<int> c(init, 0);
+ C c(init, 0);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -35,11 +38,11 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void
-test(std::deque<int>& c1, int x)
+test(C& c1, int x)
{
- typedef std::deque<int> C;
- typedef C::iterator I;
+ typedef typename C::iterator I;
std::size_t c1_osize = c1.size();
c1.push_front(x);
assert(c1.size() == c1_osize + 1);
@@ -51,19 +54,30 @@ test(std::deque<int>& c1, int x)
assert(*i == j);
}
+template <class C>
void
testN(int start, int N)
{
- typedef std::deque<int> C;
- C c1 = make(N, start);
+ C c1 = make<C>(N, start);
test(c1, -10);
}
int main()
{
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int> >(rng[i], rng[j]);
+ }
+#if __cplusplus >= 201103L
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
- testN(rng[i], rng[j]);
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp Sun Jun 23 16:17:24 2013
@@ -15,10 +15,12 @@
#include <cassert>
#include "../../../MoveOnly.h"
+#include "../../../min_allocator.h"
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-std::deque<MoveOnly>
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -29,7 +31,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<MoveOnly> c(init);
+ C c(init);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -39,11 +41,11 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void
-test(std::deque<MoveOnly>& c1, int x)
+test(C& c1, int x)
{
- typedef std::deque<MoveOnly> C;
- typedef C::iterator I;
+ typedef typename C::iterator I;
std::size_t c1_osize = c1.size();
c1.push_front(MoveOnly(x));
assert(c1.size() == c1_osize + 1);
@@ -55,11 +57,11 @@ test(std::deque<MoveOnly>& c1, int x)
assert(*i == MoveOnly(j));
}
+template <class C>
void
testN(int start, int N)
{
- typedef std::deque<MoveOnly> C;
- C c1 = make(N, start);
+ C c1 = make<C>(N, start);
test(c1, -10);
}
@@ -68,10 +70,21 @@ testN(int start, int N)
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<MoveOnly> >(rng[i], rng[j]);
+ }
+#if __cplusplus >= 201103L
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
- testN(rng[i], rng[j]);
+ testN<std::deque<MoveOnly, min_allocator<MoveOnly>> >(rng[i], rng[j]);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.special/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.special/copy.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.special/copy.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.special/copy.pass.cpp Sun Jun 23 16:17:24 2013
@@ -19,8 +19,10 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../../min_allocator.h"
-std::deque<int>
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -31,7 +33,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<int> c(init, 0);
+ C c(init, 0);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -41,16 +43,16 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void testN(int start, int N)
{
- typedef std::deque<int> C;
- typedef C::iterator I;
- typedef C::const_iterator CI;
+ typedef typename C::iterator I;
+ typedef typename C::const_iterator CI;
typedef random_access_iterator<I> RAI;
typedef random_access_iterator<CI> RACI;
typedef input_iterator<CI> ICI;
- C c1 = make(N, start);
- C c2 = make(N);
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(N);
assert(std::copy(c1.cbegin(), c1.cend(), c2.begin()) == c2.end());
assert(c1 == c2);
assert(std::copy(c2.cbegin(), c2.cend(), c1.begin()) == c1.end());
@@ -67,9 +69,20 @@ void testN(int start, int N)
int main()
{
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int> >(rng[i], rng[j]);
+ }
+#if __cplusplus >= 201103L
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
- testN(rng[i], rng[j]);
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.special/copy_backward.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.special/copy_backward.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.special/copy_backward.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.special/copy_backward.pass.cpp Sun Jun 23 16:17:24 2013
@@ -19,8 +19,10 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../../min_allocator.h"
-std::deque<int>
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -31,7 +33,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<int> c(init, 0);
+ C c(init, 0);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -41,15 +43,15 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void testN(int start, int N)
{
- typedef std::deque<int> C;
- typedef C::iterator I;
- typedef C::const_iterator CI;
+ typedef typename C::iterator I;
+ typedef typename C::const_iterator CI;
typedef random_access_iterator<I> RAI;
typedef random_access_iterator<CI> RACI;
- C c1 = make(N, start);
- C c2 = make(N);
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(N);
assert(std::copy_backward(c1.cbegin(), c1.cend(), c2.end()) == c2.begin());
assert(c1 == c2);
assert(std::copy_backward(c2.cbegin(), c2.cend(), c1.end()) == c1.begin());
@@ -66,9 +68,20 @@ void testN(int start, int N)
int main()
{
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int> >(rng[i], rng[j]);
+ }
+#if __cplusplus >= 201103L
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
- testN(rng[i], rng[j]);
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.special/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.special/move.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.special/move.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.special/move.pass.cpp Sun Jun 23 16:17:24 2013
@@ -19,8 +19,10 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../../min_allocator.h"
-std::deque<int>
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -31,7 +33,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<int> c(init, 0);
+ C c(init, 0);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -41,15 +43,15 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void testN(int start, int N)
{
- typedef std::deque<int> C;
- typedef C::iterator I;
- typedef C::const_iterator CI;
+ typedef typename C::iterator I;
+ typedef typename C::const_iterator CI;
typedef random_access_iterator<I> RAI;
typedef random_access_iterator<CI> RACI;
- C c1 = make(N, start);
- C c2 = make(N);
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(N);
assert(std::move(c1.cbegin(), c1.cend(), c2.begin()) == c2.end());
assert(c1 == c2);
assert(std::move(c2.cbegin(), c2.cend(), c1.begin()) == c1.end());
@@ -66,9 +68,20 @@ void testN(int start, int N)
int main()
{
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int> >(rng[i], rng[j]);
+ }
+#if __cplusplus >= 201103L
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
- testN(rng[i], rng[j]);
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.special/move_backward.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.special/move_backward.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.special/move_backward.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.special/move_backward.pass.cpp Sun Jun 23 16:17:24 2013
@@ -19,8 +19,10 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../../min_allocator.h"
-std::deque<int>
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -31,7 +33,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<int> c(init, 0);
+ C c(init, 0);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -41,15 +43,15 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void testN(int start, int N)
{
- typedef std::deque<int> C;
- typedef C::iterator I;
- typedef C::const_iterator CI;
+ typedef typename C::iterator I;
+ typedef typename C::const_iterator CI;
typedef random_access_iterator<I> RAI;
typedef random_access_iterator<CI> RACI;
- C c1 = make(N, start);
- C c2 = make(N);
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(N);
assert(std::move_backward(c1.cbegin(), c1.cend(), c2.end()) == c2.begin());
assert(c1 == c2);
assert(std::move_backward(c2.cbegin(), c2.cend(), c1.end()) == c1.begin());
@@ -66,9 +68,20 @@ void testN(int start, int N)
int main()
{
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int> >(rng[i], rng[j]);
+ }
+#if __cplusplus >= 201103L
+ {
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
- testN(rng[i], rng[j]);
+ testN<std::deque<int, min_allocator<int> > >(rng[i], rng[j]);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/deque.special/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/deque.special/swap.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/deque.special/swap.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/deque.special/swap.pass.cpp Sun Jun 23 16:17:24 2013
@@ -15,8 +15,10 @@
#include <deque>
#include <cassert>
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
-std::deque<int>
+template <class C>
+C
make(int size, int start = 0 )
{
const int b = 4096 / sizeof(int);
@@ -27,7 +29,7 @@ make(int size, int start = 0 )
init *= b;
--init;
}
- std::deque<int> c(init, 0);
+ C c(init, 0);
for (int i = 0; i < init-start; ++i)
c.pop_back();
for (int i = 0; i < size; ++i)
@@ -37,11 +39,11 @@ make(int size, int start = 0 )
return c;
};
+template <class C>
void testN(int start, int N, int M)
{
- typedef std::deque<int> C;
- C c1 = make(N, start);
- C c2 = make(M);
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
C c1_save = c1;
C c2_save = c2;
swap(c1, c2);
@@ -57,7 +59,7 @@ int main()
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
for (int k = 0; k < N; ++k)
- testN(rng[i], rng[j], rng[k]);
+ testN<std::deque<int> >(rng[i], rng[j], rng[k]);
}
{
int a1[] = {1, 3, 7, 9, 10};
@@ -83,4 +85,26 @@ int main()
assert((c2 == std::deque<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
assert(c2.get_allocator() == A(1));
}
+#if __cplusplus >= 201103L
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j], rng[k]);
+ }
+ {
+ int a1[] = {1, 3, 7, 9, 10};
+ int a2[] = {0, 2, 4, 5, 6, 8, 11};
+ typedef min_allocator<int> A;
+ std::deque<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A());
+ std::deque<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A());
+ swap(c1, c2);
+ assert((c1 == std::deque<int, A>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
+ assert(c1.get_allocator() == A());
+ assert((c2 == std::deque<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
+ assert(c2.get_allocator() == A());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/iterators.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/iterators.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/iterators.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/iterators.pass.cpp Sun Jun 23 16:17:24 2013
@@ -20,8 +20,11 @@
#include <iterator>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef std::deque<int> C;
C c;
C::iterator i;
@@ -29,4 +32,16 @@ int main()
C::const_iterator j;
j = c.cbegin();
assert(i == j);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::deque<int, min_allocator<int>> C;
+ C c;
+ C::iterator i;
+ i = c.begin();
+ C::const_iterator j;
+ j = c.cbegin();
+ assert(i == j);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/sequences/deque/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/deque/types.pass.cpp?rev=184673&r1=184672&r2=184673&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/deque/types.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/deque/types.pass.cpp Sun Jun 23 16:17:24 2013
@@ -35,6 +35,7 @@
#include "../../test_allocator.h"
#include "../../Copyable.h"
+#include "../../min_allocator.h"
template <class T, class Allocator>
void
@@ -72,4 +73,17 @@ int main()
test<Copyable, test_allocator<Copyable> >();
static_assert((std::is_same<std::deque<char>::allocator_type,
std::allocator<char> >::value), "");
+#if __cplusplus >= 201103L
+ {
+ typedef std::deque<short, min_allocator<short>> C;
+ static_assert((std::is_same<C::value_type, short>::value), "");
+ static_assert((std::is_same<C::allocator_type, min_allocator<C::value_type> >::value), "");
+ static_assert((std::is_same<C::reference, C::value_type&>::value), "");
+ static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
+ static_assert((std::is_same<C::pointer, min_pointer<C::value_type>>::value), "");
+ static_assert((std::is_same<C::const_pointer, min_pointer<const C::value_type>>::value), "");
+ static_assert((std::is_same<C::size_type, std::size_t>::value), "");
+ static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
+ }
+#endif
}
More information about the cfe-commits
mailing list