This example code is explained in the STXXL Deque section.
#include <iostream>
int main()
{
deque my_deque;
unsigned int smaller_left = 0;
unsigned int smaller_right = 0;
{
random = rand32();
my_deque.push_front(random);
}
p = (unsigned int)(rand32() % number_of_elements);
x = my_deque[p];
{
if (*deque_iterator < x)
{
smaller_left += 1;
}
++deque_iterator;
}
++deque_iterator;
{
if (*deque_iterator < x)
{
smaller_right += 1;
}
++deque_iterator;
}
STXXL_MSG(
"smaller left: " << smaller_left <<
", smaller right: " << smaller_right);
return 0;
}