summaryrefslogtreecommitdiff
path: root/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp')
-rw-r--r--test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp53
1 files changed, 52 insertions, 1 deletions
diff --git a/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp b/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp
index 54227ebc1..9ac342a8f 100644
--- a/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp
@@ -16,9 +16,13 @@
#include <cassert>
#include <cstddef>
+#include "test_macros.h"
#include "test_iterators.h"
#include "test_allocator.h"
#include "min_allocator.h"
+#if TEST_STD_VER >= 11
+#include "emplace_constructible.h"
+#endif
template <class InputIterator, class Allocator>
void
@@ -35,7 +39,7 @@ test(InputIterator f, InputIterator l, const Allocator& a)
assert(*i == *f);
}
-int main()
+void basic_test()
{
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]);
@@ -50,3 +54,50 @@ int main()
test(random_access_iterator<const int*>(ab), random_access_iterator<const int*>(an), min_allocator<int>());
#endif
}
+
+
+void test_emplacable_concept() {
+#if TEST_STD_VER >= 11
+ int arr1[] = {42};
+ int arr2[] = {1, 101, 42};
+ {
+ using T = EmplaceConstructibleAndMoveable<int>;
+ using It = random_access_iterator<int*>;
+ std::allocator<T> a;
+ {
+ std::deque<T> v(It(arr1), It(std::end(arr1)), a);
+ assert(v[0].value == 42);
+ }
+ {
+ std::deque<T> v(It(arr2), It(std::end(arr2)), a);
+ assert(v[0].value == 1);
+ assert(v[1].value == 101);
+ assert(v[2].value == 42);
+ }
+ }
+ {
+ using T = EmplaceConstructibleAndMoveable<int>;
+ using It = input_iterator<int*>;
+ std::allocator<T> a;
+ {
+ std::deque<T> v(It(arr1), It(std::end(arr1)), a);
+ assert(v[0].copied == 0);
+ assert(v[0].value == 42);
+ }
+ {
+ std::deque<T> v(It(arr2), It(std::end(arr2)), a);
+ //assert(v[0].copied == 0);
+ assert(v[0].value == 1);
+ //assert(v[1].copied == 0);
+ assert(v[1].value == 101);
+ assert(v[2].copied == 0);
+ assert(v[2].value == 42);
+ }
+ }
+#endif
+}
+
+int main() {
+ basic_test();
+ test_emplacable_concept();
+}