C++'s std::inclusive_scan recognises the case which accepts an initial value. To deal with this case, the input array of values is prepended with the initial value and the prefix sum is computed on the resulting array in an inclusive manner. Check here.