[libcxx-commits] [PATCH] D67273: [libc++] Remove unnecessary assignment in exclusive_scan

Billy Robert O'Neal III via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Sep 6 18:26:38 PDT 2019


BillyONeal added a comment.

> I have not run either through tests yet...

I should have done that before posting, tests fail with the 2 iterator version because it doesn't handle the self-aliasing case. This version combines the good parts of both our implementations and passes tests.

  if (_UFirst != _ULast) {
      _Ty _Tmp(_Reduce_op(_Val, *_UFirst)); // temp to enable _First == _Dest, also requirement missing
      for (;;) {
          *_UDest = _Val;
          ++_UDest;
          ++_UFirst;
          if (_UFirst == _ULast) {
              break;
          }
  
          _Val = _STD move(_Tmp); // Requirement missing from N4713
          _Tmp = _Reduce_op(_Val, *_UFirst);
      }
  }


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67273/new/

https://reviews.llvm.org/D67273





More information about the libcxx-commits mailing list