
Support for the C++11 range-based for statement and BOOST_FOREACH for directory_iterator and recursive_directory_iterator has been added to trunk. This clears feature requests 5896 and 6521.
The range-based for has been tested against gcc 4.6, which works, and against VC++2012 RC, which ICEs the compiler. The ICE has been reported to Microsoft.
If anyone gives either C++11 range-based for or BOOST_FOREACH a try, I'd appreciate hearing about any problems. Both of these are new to me, and I'm nervous about getting the enabler free functions right.
Here is what usage looks like:
for (directory_entry& x : directory_iterator(".")) { std::cout << " " << x.path() << "\n"; }
BOOST_FOREACH(directory_entry& x, directory_iterator(".")) { std::cout << " " << x.path() << "\n"; }
I'm a little surprised to see a function that returns a range named "directory_iterator". Other Boost libraries, such as Boost.Iterator and Boost.Range, distinguish between the concepts of an iterator, which denotes a single position in a range, and a range, which is defined by iterators at is beginning and its end. Have you considered naming the function "directory_range" to be consistent with other Boost libraries? Otherwise, great idea! Regards, Nate