Original vector:
std::vector<int> a{1, 2, 3, 4, 5, 6};
vector of indices:
std::vector<int> b{1, 3, 4};
Multiply by 10 each element in a that is indexed by the elements in b. Iterative implementation:
for (auto i = 0; i < b.size(); ++i)
a[b[i]] *= 10;
Resulting a:
1 20 3 40 50 6
I wonder if I can apply a filter | transform composition from range-v3 to accomplish this? Or could this be done with the pre-range standard algorithms?