1 #include <string>
2 #include <iostream>
3 #include <boost/foreach.hpp>
4
5 #define foreach BOOST_FOREACH
6
7
8 int main()
9 {
10 std::string hello("Hello,World!");
11
12 foreach(char ch,hello)
13 {
14 std::cout << ch;
15 }
16
17 return 0;
18 }
支持类型:STL containers,arrays,Null-terminated strings,std::pair of iterators