[PATCH] D44175: Add std:: to begin and end in drop_begin

Krzysztof Parzyszek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 6 14:05:54 PST 2018


kparzysz created this revision.
kparzysz added a reviewer: dblaikie.

Compiling this code gives me "undeclared symbol" errors for `begin` and `end` in `drop_begin`:

  if (const auto *A = dyn_cast<SCEVAddExpr>(R->getStart())) {
    if (const auto *C = dyn_cast<SCEVConstant>(A->getOperand(0))) {
      SmallVector<const SCEV*,2> Ops1(drop_begin(A->operands(), 1));
      const SCEV *NA = SE->getAddExpr(Ops1, A->getNoWrapFlags());
    }
  }

This change is intended to fix that.


Repository:
  rL LLVM

https://reviews.llvm.org/D44175

Files:
  include/llvm/ADT/iterator_range.h


Index: include/llvm/ADT/iterator_range.h
===================================================================
--- include/llvm/ADT/iterator_range.h
+++ include/llvm/ADT/iterator_range.h
@@ -60,8 +60,9 @@
 }
 
 template<typename T>
-iterator_range<decltype(begin(std::declval<T>()))> drop_begin(T &&t, int n) {
-  return make_range(std::next(begin(t), n), end(t));
+iterator_range<decltype(std::begin(std::declval<T>()))>
+drop_begin(T &&t, int n) {
+  return make_range(std::next(std::begin(t), n), std::end(t));
 }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44175.137273.patch
Type: text/x-patch
Size: 520 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180306/727bf730/attachment-0001.bin>


More information about the llvm-commits mailing list