int main( int argc, char *argv[] ) { CircularQueue< int, 4 > q; q.ReplaceBackOfQueueOrPush(1); q.ReplaceBackOfQueueOrPush(2); q.ReplaceBackOfQueueOrPush(3); q.ReplaceBackOfQueueOrPush(4); q.ReplaceBackOfQueueOrPush(5); std::vector< int > prior2 = q.PopNOrLess( 2 ); // 2, 3 std::vector< int > last2 = q.PopNOrLess( 2 ); // 4, 5 q.ReplaceBackOfQueueOrPush(6); q.ReplaceBackOfQueueOrPush(7); q.ReplaceBackOfQueueOrPush(8); q.ReplaceBackOfQueueOrPush(9); q.ReplaceBackOfQueueOrPush(10); q.ReplaceBackOfQueueOrPush(11); q.ReplaceBackOfQueueOrPush(12); std::vector< int > final6 = q.PopNOrLess( 6 ); // Will only get => 9, 10, 11, 12 std::vector< int > none = q.PopNOrLess( 1 ); // There will be nothing in this return 0; }