Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <typename type>
- void print(type it_begin, type it_end) {
- bool start_print = false;
- while(it_end != it_begin) {
- --it_end;
- if (*it_end < 0) {
- start_print = true;
- continue;
- }
- if (start_print) {
- std::cout << *it_end << "\n";
- }
- }
- }
- int main() {
- std::vector<int> a = {6,1,8,-5, 4};
- print(a.begin(), a.end()); // 8 1 6
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement