summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOskar <[email protected]>2024-10-09 21:54:37 +0200
committerOskar <[email protected]>2024-10-09 21:54:37 +0200
commitf46aaa42631113d83bc211a9db4f85ef68afdc92 (patch)
tree4045b35f8959e69afc80a5c2d2462e7e638001e5
parent12f648998464e7820e2be633e4d999c285047bce (diff)
more
-rw-r--r--container-tests.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/container-tests.cpp b/container-tests.cpp
new file mode 100644
index 0000000..ef01098
--- /dev/null
+++ b/container-tests.cpp
@@ -0,0 +1,47 @@
+#include <iostream>
+#include <vector>
+#include <list>
+#include <deque>
+#include <array>
+#include <string>
+
+/*
+ *
+ *
+ *
+ *
+ */
+
+void deque_popfront_pushback_subscript() {
+
+ std::deque<int> di{1,2,3,4,5,6,7,8,9,10};
+ for(int i = 0 ; i != 100000 ; ++i) {
+ for(auto &a : di) {
+ std::cout << a << " " ;
+ }
+ std::cout << std::endl;
+ di.pop_front();
+ di.push_back(di[8]+1);
+ }
+}
+
+void deque_popfront_pushback_iterator() {
+
+ std::deque<int> di{1,2,3,4,5,6,7,8,9,10};
+ for(int i = 0 ; i != 100000 ; ++i) {
+ for(auto &a : di) {
+ std::cout << a << " " ;
+ }
+ std::cout << std::endl;
+ di.pop_front();
+ auto a = di.rbegin();
+ di.push_back(*a+1);
+ }
+}
+
+int main () {
+
+ deque_popfront_pushback_iterator();
+ deque_popfront_pushback_subscript();
+ return 0;
+}