c++11 - Iteration over a big std::vector -
i have c++ vector of tuples. tuples consist of 3 doubles , 1 integer. vector may contain hundreds of thousands of elements. using c++11 for(auto element : vector){} loop, manage iterate on no more 100k elements. there other solution iterating on whole "big" vector (currently 275k elements)? code:
for(auto record : rd) { // find indices: indxsc = std::get<2>(record) - 1; indxsp = static_cast<int>( std::get<0>(record)/0.3 ); if(indxsp > 47 )indxsp = 46; indxdir = findsector72( std::get<1>(record) ); // increment counts in bins ++cntsit[indxsc][indxsp][indxdir]; ++cntspeed[indxsp]; // add reciprocal of wind speed sum <1/u> valspeed[indxsp] = valspeed[indxsp] + 1./( std::get<0>(record) ); }
Comments
Post a Comment