#include <iostream>
#include <algorithm>
#include <deque>
int main()
{
std::deque<int> dq = { 3, 1, 21, 12, 13, 6, 8, 7 };
int x = 4;
int y = 13;
auto pos = find_if(dq.cbegin(), dq.cend(), [=](int i) { return i > x && i < y;});
std::cout << "The first element that >4 and <13 is: " << *pos << std::endl;
return 0;
}
/*
run:
The first element that >4 and <13 is: 12
*/