SHARE
TWEET

Untitled

a guest Sep 17th, 2019 103 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. template <typename InputIterator, typename OutputIterator, typename T, typename BinaryOp>
  2. OutputIterator exclusive_scan(InputIterator first, InputIterator last,
  3.                               OutputIterator result, T init, BinaryOp op)
  4. {
  5.   if (first != last) {
  6.     T saved = init;
  7.     do {
  8.       init = op(init, *first);
  9.       *result = saved;
  10.       saved = init;
  11.       ++result;
  12.     } while (++first != last);
  13.   }
  14.   return result;
  15. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top