Starting with this... for( j = joff; j < joff + 8; j++) for( i = ioff; i < ioff + 8; i++) img->m7[j][i] = iClip1(img->max_imgpel_value, (img->m7[j][i]+(long)mpr[j][i])); I'd like to move as much of the loop invariance out of the loop as I can. So I tried this... using boost :: lambda :: _1; using boost :: lambda :: _2; int ilast = ioff + 8; int jlast = joff + 8; boost :: function< int( int &, int ) > clip = _1 = boost :: lambda :: bind( iClip1, img -> max_imgpel_value, _1 + _2 ); for( j = joff; j != jlast; ++ j ) for( i = ioff; i != ilast; ++ i ) clip( img -> m7[j][i], mpr[j][i] ); Which works, but I'd like the nested clip function to be fn( i, j ), so I tried this... boost :: function< void( int, int ) > clip2 = boost :: lambda :: bind( clip, img -> m7[ _2 ][ _1 ], mpr[ _2 ][ _1 ] ); for( j = joff; j != jlast; ++ j ) for( i = ioff; i != ilast; ++ i ) clip2( i, j ); Which doesn't work. I think I need some boost::refs around the arrays I'm subscripting, but I can't quite seem to get it right. Error is... loop.cpp:50: error: no match for 'operator[]' in 'img->img_par::m7[boost::lambda::<unnamed>::_2]' loop.cpp:50: error: no match for 'operator[]' in 'mpr[boost::lambda::<unnamed>::_2]' loop.cpp:50: error: `bind' undeclared (first use this function) Any thoughts? Thanks, Rob.