replace ccr_::enumerate with flexible for_each

enumerate is unusual and would only work effectively with random access iterators

this for_each takes advantage of tbb blocked_range
replace ccr_::enumerate with flexible for_each

enumerate is unusual and would only work effectively with random access iterators

this for_each takes advantage of tbb blocked_range
This commit is contained in:
tamasmeszaros 2020-08-05 15:49:36 +02:00
parent 9486901b93
commit 929cea59f3
7 changed files with 169 additions and 125 deletions

View file

@ -385,12 +385,13 @@ public:
template<class Fn> void draw_layers(size_t layer_num, Fn &&drawfn)
{
m_layers.resize(layer_num);
sla::ccr::enumerate(m_layers.begin(), m_layers.end(),
[this, &drawfn](sla::EncodedRaster& enc, size_t idx) {
auto rst = create_raster();
drawfn(*rst, idx);
enc = rst->encode(get_encoder());
});
sla::ccr::for_each(0ul, m_layers.size(),
[this, &drawfn] (size_t idx) {
sla::EncodedRaster& enc = m_layers[idx];
auto rst = create_raster();
drawfn(*rst, idx);
enc = rst->encode(get_encoder());
});
}
};