.. _program_listing_file_src_pcms_utility_inclusive_scan.h: Program Listing for File inclusive_scan.h ========================================= |exhale_lsh| :ref:`Return to documentation for file ` (``src/pcms/utility/inclusive_scan.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #ifndef PCMS_INCLUSIVE_SCAN_H #define PCMS_INCLUSIVE_SCAN_H namespace pcms { template OutputIt inclusive_scan(InputIt first, InputIt last, OutputIt d_first) { typename InputIt::value_type last_val = 0; for (auto it = first; it != last; ++it) { last_val = last_val + *it; *d_first = last_val; ++d_first; } return d_first; } } // namespace pcms #endif