Thank you for the great work
As written in the title, I want to use the robin_map instead of std::unordered_map in lambda function.
Jumping into the code right away, the code below works well with std::unordered_map.
struct DataType
{
bool to_be_del = false;
DataType(){};
}
unordered_map<KeyType, DataType> candidates;
tbb::parallel_for_each(candidates.begin(), candidates.end(), [&](auto &cand_)
{
if (some_condition)
{
cand_.second.to_be_del = true;
}
});
But, as robin_map returns const iterator, the below code cannot be compiled.
tsl::robin_map<KeyType, DataType> candidates;
tbb::parallel_for_each(candidates.begin(), candidates.end(), [&](auto &cand_)
{
if (some_condition)
{
cand_.second.to_be_del = true; // modifying const iterator
cand_.value().to_be_del = true; // errors: cand_ has no member function named 'value()'
}
});
As can be seen, I want to use tbb::parallel_for or tbb::parallel_for_each for faster computations.
So I would like to ask if there is a proper way to use robin_map and capture the iterator to modify the value within the lambda function!
Thank you in advance.
Thank you for the great work
As written in the title, I want to use the
robin_mapinstead ofstd::unordered_mapin lambda function.Jumping into the code right away, the code below works well with
std::unordered_map.But, as
robin_mapreturns const iterator, the below code cannot be compiled.As can be seen, I want to use
tbb::parallel_forortbb::parallel_for_eachfor faster computations.So I would like to ask if there is a proper way to use
robin_mapand capture the iterator to modify the value within the lambda function!Thank you in advance.