Replace problematic uses of std::iota.