From f46aaa42631113d83bc211a9db4f85ef68afdc92 Mon Sep 17 00:00:00 2001 From: Oskar Date: Wed, 9 Oct 2024 21:54:37 +0200 Subject: more --- container-tests.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 container-tests.cpp 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 +#include +#include +#include +#include +#include + +/* + * + * + * + * + */ + +void deque_popfront_pushback_subscript() { + + std::deque 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 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; +} -- cgit v1.2.3