2013年7月17日
摘要: BOOST_FOREACH简化了C++的循环遍历序列元素。支持的序列类型:Boost.Range识别的序列STL容器数组Null-terminated Stringstd::pair of iterators#include #include #include int main(){ std::string hello( "Hello, world!" ); BOOST_FOREACH( char ch, hello ) { std::cout list_int( /*...*/ );BOOST_FOREACH( int i, list_int ){ /... 阅读全文
posted @ 2013-07-17 15:31 chenkkkabc 阅读(356) 评论(0) 推荐(0) 编辑
摘要: http://www.cplusplus.com/reference/algorithm/for_each/对一个序列应用函数。可以是函数指针,或者是functor。// for_each example#include // std::cout#include // std::for_each#include // std::vectorvoid myfunction (int i) { // function: std::cout myvector; myvector.push_back(10); myvector.push_back(20); ... 阅读全文
posted @ 2013-07-17 12:26 chenkkkabc 阅读(251) 评论(0) 推荐(0) 编辑