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 /9p23.cpp | |
parent | 428d857359b5d8b639ca41b03ca8fc8b3d143a50 (diff) |
more
Diffstat (limited to '9p23.cpp')
-rw-r--r-- | 9p23.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/9p23.cpp b/9p23.cpp new file mode 100644 index 0000000..432e77f --- /dev/null +++ b/9p23.cpp @@ -0,0 +1,32 @@ +#include <iostream> +#include <vector> + +/* + * + * 9.23 + * + * + */ + +int main () { + + std::vector<int> c = {1}; + if (c.size() == 1) { + // val and val2 are copies of the value of the first element in c + auto val = *c.begin(), val2 = c.front(); + // val3 and val4 are copies of the of the last element in c + auto last = c.end(); + auto val3 = *(--last); // can’t decrement forward_list iterators + auto val4 = c.back(); // not supported by forward_list + + std::cout << val << "\n" + << val2 << "\n" + << val3 << "\n" + << val4 << "\n"; + if(val || val2 || val3 || val4) {} + + } + + + return 0; +} |