summaryrefslogtreecommitdiffstats
path: root/libcxx/test/containers/sequences/vector/iterators.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/containers/sequences/vector/iterators.pass.cpp')
-rw-r--r--libcxx/test/containers/sequences/vector/iterators.pass.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/libcxx/test/containers/sequences/vector/iterators.pass.cpp b/libcxx/test/containers/sequences/vector/iterators.pass.cpp
index 9ebd20bd6bb..fbd40298d19 100644
--- a/libcxx/test/containers/sequences/vector/iterators.pass.cpp
+++ b/libcxx/test/containers/sequences/vector/iterators.pass.cpp
@@ -20,6 +20,14 @@
#include <cassert>
#include <iterator>
+#include "../../min_allocator.h"
+
+struct A
+{
+ int first;
+ int second;
+};
+
int main()
{
{
@@ -69,4 +77,62 @@ int main()
C::iterator i;
C::const_iterator j;
}
+#if __cplusplus >= 201103L
+ {
+ typedef int T;
+ typedef std::vector<T, min_allocator<T>> C;
+ C c;
+ C::iterator i = c.begin();
+ C::iterator j = c.end();
+ assert(std::distance(i, j) == 0);
+ assert(i == j);
+ }
+ {
+ typedef int T;
+ typedef std::vector<T, min_allocator<T>> C;
+ const C c;
+ C::const_iterator i = c.begin();
+ C::const_iterator j = c.end();
+ assert(std::distance(i, j) == 0);
+ assert(i == j);
+ }
+ {
+ typedef int T;
+ typedef std::vector<T, min_allocator<T>> C;
+ C c;
+ C::const_iterator i = c.cbegin();
+ C::const_iterator j = c.cend();
+ assert(std::distance(i, j) == 0);
+ assert(i == j);
+ assert(i == c.end());
+ }
+ {
+ typedef int T;
+ typedef std::vector<T, min_allocator<T>> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t), std::end(t));
+ C::iterator i = c.begin();
+ assert(*i == 0);
+ ++i;
+ assert(*i == 1);
+ *i = 10;
+ assert(*i == 10);
+ assert(std::distance(c.begin(), c.end()) == 10);
+ }
+ {
+ typedef int T;
+ typedef std::vector<T, min_allocator<T>> C;
+ C::iterator i;
+ C::const_iterator j;
+ }
+ {
+ typedef A T;
+ typedef std::vector<T, min_allocator<T>> C;
+ C c = {A{1, 2}};
+ C::iterator i = c.begin();
+ i->first = 3;
+ C::const_iterator j = i;
+ assert(j->first == 3);
+ }
+#endif
}
OpenPOWER on IntegriCloud