diff options
author | Oskar <[email protected]> | 2024-10-15 17:05:33 +0200 |
---|---|---|
committer | Oskar <[email protected]> | 2024-10-15 17:05:33 +0200 |
commit | 7db4642f463244fdbacd2b20f261398c9de38fd9 (patch) | |
tree | a6f79131c824e489518749b17b7f4e452046e36b /9p27.cpp | |
parent | 428d857359b5d8b639ca41b03ca8fc8b3d143a50 (diff) |
more
Diffstat (limited to '9p27.cpp')
-rw-r--r-- | 9p27.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/9p27.cpp b/9p27.cpp new file mode 100644 index 0000000..07913f8 --- /dev/null +++ b/9p27.cpp @@ -0,0 +1,36 @@ +#include <iostream> +#include <forward_list> + +/* + * + * 9.27 + * + * + */ + +int main () { + + std::forward_list<int> flst = {0,1,2,3,4,5,6,7,8,9}; + for(auto &a : flst) { + std::cout << a << "\n"; + } + + auto bbeg = flst.before_begin(); + auto beg = flst.begin(); + auto end = flst.cend(); + while(beg != end) { + if(*beg % 2 == 1) { + beg = flst.erase_after(bbeg); + } else { + bbeg = beg; + ++beg; + } + } + + std::cout << std::endl; + for(auto &a : flst) { + std::cout << a << "\n"; + } + + return 0; +} |