void operator()( const tbb::blocked_range<int>& range ) const { ASSERT( range.begin() < range.end(), NULL ); #if TBB_DEPRECATED for( int i=range.begin(); i!=range.end(); ++i ) #else const int h = range.size() / 2 ; { const int begin = range.begin(); const int left_part = h/2 ; const int right_part = h - left_part; //elements added by this call are counted by copy_inits_by_grow_by_range variable bellow my_vector.grow_by(FooIterator(begin),FooIterator(begin+left_part)); //these ones are counted by def_inits_by_grow_by_bunch typename MyVector::iterator const s = my_vector.grow_by(right_part); for( int k = 0; k < right_part; ++k ) s[k].bar() = begin + left_part + k; } for(int i=range.begin() + h; i!=range.end(); ++i ) #endif { if( i&1 ) {//counted by def_inits_by_grow_by_single_odd #if TBB_DEPRECATED my_vector[my_vector.grow_by(1)].bar() = i; #else my_vector.grow_by(1)->bar() = i; #endif } else {// "Even" part typename MyVector::value_type f; f.bar() = i; #if TBB_DEPRECATED size_t r; #else typename MyVector::iterator r; #endif if( i&2 ){ //counted by copy_inits_by_push_back_single_second_bit_set r = my_vector.push_back( f ); }else{ //counted by copy_inits_by_grow_by_single_second_bit_cleared_part r = my_vector.grow_by(1, f); } #if TBB_DEPRECATED ASSERT( my_vector[r].bar()==i, NULL ); #else ASSERT( r->bar()==i, NULL ); #endif } } }
void operator()( const tbb::blocked_range<int>& range ) const { ASSERT( range.begin() < range.end(), NULL ); #if TBB_DEPRECATED for( int i=range.begin(); i!=range.end(); ++i ) #else int i = range.begin(), h = (range.end() - i) / 2; typename MyVector::iterator s = my_vector.grow_by(h); for( h += i; i < h; ++i, ++s ) s->bar() = i; for(; i!=range.end(); ++i ) #endif { if( i&1 ) { #if TBB_DEPRECATED typename MyVector::reference element = my_vector[my_vector.grow_by(1)]; element.bar() = i; #else my_vector.grow_by(1)->bar() = i; #endif } else { typename MyVector::value_type f; f.bar() = i; #if TBB_DEPRECATED size_t r; #else typename MyVector::iterator r; #endif if( i&2 ) r = my_vector.push_back( f ); else r = my_vector.grow_by(1, f); #if TBB_DEPRECATED ASSERT( my_vector[r].bar()==i, NULL ); #else ASSERT( r->bar()==i, NULL ); #endif } } }