Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1067301
  • 博文数量: 264
  • 博客积分: 6005
  • 博客等级: 大校
  • 技术积分: 2798
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-08 20:15
文章分类

全部博文(264)

文章存档

2011年(42)

2010年(213)

2009年(4)

2008年(2)

2007年(3)

分类:

2010-10-09 20:42:58

his program outputs the following:
Hello, world!
==============================================
std::list<int> list_int( /*...*/ ); BOOST_FOREACH( int i, list_int ) { // do something with i }
=============================================
short array_short[] = {1,2,3}; BOOST_FOREACH( int i, array_short ) { // The short was implicitly converted to an int } ============================================
std::deque<int> deque_int( /*...*/ ); int i = 0; BOOST_FOREACH( i, deque_int ) { if( i == 0 ) return; if( i == 1 ) continue; if( i == 2 ) break; } ============================================
short array_short[] = { 1, 2, 3 }; BOOST_FOREACH( short & i, array_short ) { ++i; } // array_short contains {2,3,4} here
===========================================

std::vector<std::vector<int> > matrix_int; BOOST_FOREACH( std::vector<int> & row, matrix_int )
{
BOOST_FOREACH( int & i, row )
    {
        ++i;
    }
}

=======================================

extern std::vector<float> get_vector_float(); BOOST_FOREACH( float f, get_vector_float() ) { // Note: get_vector_float() will be called exactly once }
=======================================
#define foreach BOOST_FOREACH #define reverse_foreach BOOST_REVERSE_FOREACH
阅读(562) | 评论(0) | 转发(0) |
0

上一篇:libmaia: XML-RPC with Qt4

下一篇:Boost.Foreach 1

给主人留下些什么吧!~~