void operator()( const RangeType& range ) const {
     for( typename RangeType::iterator i = range.begin(); i!=range.end(); ++i ) {
         int k = i->first.value_of();
         ASSERT( 0<=k && size_t(k)<n, NULL );
         ++array[k];
     }
 }
Exemplo n.º 2
0
 void operator()( const RangeType& range ) const {
     for( typename RangeType::iterator i = range.begin(); i!=range.end(); ++i ) {
         int k = Value<ContainerType>::key(*i);
         ASSERT( k == Value<ContainerType>::get(*i), NULL );
         ASSERT( 0<=k && k<n, NULL ); 
         array[k]++;
     }
 }
 void operator()( const RangeType& range ) const {
     for( typename RangeType::iterator i = range.begin(); i!=range.end(); ++i ) {
         int k = i->first;
         ASSERT( k == i->second, NULL );
         ASSERT( 0<=k && k<n, NULL ); 
         array[k]++;
     }
 }
Exemplo n.º 4
0
std::pair<int,int> CheckRecursiveRange(RangeType range) {
    std::pair<int,int> sum(0, 0); // count, sum
    for( Iterator i = range.begin(), e = range.end(); i != e; ++i ) {
        ++sum.first; sum.second += Value<ContainerType>::get(*i);
    }
    if( range.is_divisible() ) {
        RangeType range2( range, tbb::split() );
        std::pair<int,int> sum1 = CheckRecursiveRange<ContainerType,Iterator, RangeType>( range );
        std::pair<int,int> sum2 = CheckRecursiveRange<ContainerType,Iterator, RangeType>( range2 );
        sum1.first += sum2.first; sum1.second += sum2.second;
        ASSERT( sum == sum1, "Mismatched ranges after division");
    }
    return sum;
}