sequential_prefix_sum-snippet.h 192 Bytes
Newer Older
1 2 3 4 5
std::vector<int> output_range(input_range.size());
output_range[0] = input_range[0];
for(size_t i = 1; i < input_range.size(); i++) {
  output_range[i] = output_range[i-1] + input_range[i];
}