#include <boost/preprocessor/cat.hpp>
Go to the source code of this file.
Classes | |
| class | mongo::BSONObjIterator |
| class | mongo::BSONObjIteratorSorted |
Namespaces | |
| namespace | mongo |
Defines | |
| #define | BSONForEach(e, obj) |
| #define BSONForEach | ( | e, | |||
| obj | ) |
BSONObjIterator BOOST_PP_CAT(it_,__LINE__)(obj); \
for ( BSONElement e; \
(BOOST_PP_CAT(it_,__LINE__).more() ? \
(e = BOOST_PP_CAT(it_,__LINE__).next(), true) : \
false) ; \
/*nothing*/ )
Similar to BOOST_FOREACH
because the iterator is defined outside of the for, you must use {} around the surrounding scope. Don't do this:
if (foo) BSONForEach(e, obj) doSomething(e);
but this is OK:
if (foo) { BSONForEach(e, obj) doSomething(e); }
Definition at line 123 of file bsonobjiterator.h.