kou commented on code in PR #47815:
URL: https://github.com/apache/arrow/pull/47815#discussion_r2552580714


##########
cpp/src/arrow/util/range.h:
##########
@@ -44,6 +44,14 @@ std::vector<T> Iota(T length) {
   return Iota(static_cast<T>(0), length);
 }
 
+/// Create a vector containing the values from start with length elements
+template <typename T>
+std::vector<T> Iota(T start, size_t length) {
+  std::vector<T> result(length);
+  std::iota(result.begin(), result.end(), start);
+  return result;
+}

Review Comment:
   I wanted to confirm whether we can do the following:
   
   ```diff
   diff --git a/cpp/src/arrow/util/range.h b/cpp/src/arrow/util/range.h
   index 2055328798..7ccf3d154d 100644
   --- a/cpp/src/arrow/util/range.h
   +++ b/cpp/src/arrow/util/range.h
   @@ -33,9 +33,7 @@ std::vector<T> Iota(T start, T stop) {
      if (start > stop) {
        return {};
      }
   -  std::vector<T> result(static_cast<size_t>(stop - start));
   -  std::iota(result.begin(), result.end(), start);
   -  return result;
   +  return Iota(start, static_cast<size_t>(stop - start));
    }
    
    /// Create a vector containing the values from 0 up to length
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to