forked from ryanhaining/cppitertools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreversed_examples.cpp
More file actions
29 lines (24 loc) · 687 Bytes
/
Copy pathreversed_examples.cpp
File metadata and controls
29 lines (24 loc) · 687 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <reversed.hpp>
#include <iostream>
#include <vector>
#include <string>
int main () {
std::vector<int> nums{1,2,3,4,5,6,7};
std::vector<std::string> words{"hey","how","are","you","doing"};
std::cout << "numbers reversed: ";
for (auto&& i : iter::reversed(nums)) {
std::cout << i << ' ';
}
std::cout << '\n';
std::cout << "greeting reversed: ";
for (auto&& s : iter::reversed(words)) {
std::cout << s << ' ';
}
std::cout << '\n';
std::cout << "statically sized array: ";
int arr[] = {1, 2, 3, 4, 5, 6, 7};
for (auto&& i : iter::reversed(arr)) {
std::cout << i << ' ';
}
std::cout << '\n';
}