1.. _Iterating_Over_a_Concurrent_Queue_for_Debugging:
2
3Iterating Over a Concurrent Queue for Debugging
4===============================================
5
6
7The template classes ``concurrent_queue`` and
8``concurrent_bounded_queue`` support STL-style iteration. This support
9is intended only for debugging, when you need to dump a queue. The
10iterators go forwards only, and are too slow to be very useful in
11production code. If a queue is modified, all iterators pointing to it
12become invalid and unsafe to use. The following snippet dumps a queue.
13The ``operator<<`` is defined for a ``Foo``.
14
15
16::
17
18
19   concurrent_queue<Foo> q;
20   ...
21   typedef concurrent_queue<Foo>::const_iterator iter;
22   for(iter i(q.unsafe_begin()); i!=q.unsafe_end(); ++i ) {
23       cout << *i;
24   }
25
26
27The prefix ``unsafe_`` on the methods is a reminder that they are not
28concurrency safe.
29
30