Skip to content

Commit a6e076f

Browse files
committed
Try to change iota
1 parent 0f87d4b commit a6e076f

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

cpp/src/arrow/util/range.h

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,21 @@
2727

2828
namespace arrow::internal {
2929

30+
/// Create a vector containing the values from start with length elements
31+
template <typename T>
32+
std::vector<T> Iota(T start, size_t length) {
33+
std::vector<T> result(length);
34+
std::iota(result.begin(), result.end(), start);
35+
return result;
36+
}
37+
3038
/// Create a vector containing the values from start up to stop
3139
template <typename T>
3240
std::vector<T> Iota(T start, T stop) {
3341
if (start > stop) {
3442
return {};
3543
}
36-
std::vector<T> result(static_cast<size_t>(stop - start));
37-
std::iota(result.begin(), result.end(), start);
38-
return result;
44+
return Iota<T>(start, static_cast<size_t>(stop - start));
3945
}
4046

4147
/// Create a vector containing the values from 0 up to length
@@ -44,14 +50,6 @@ std::vector<T> Iota(T length) {
4450
return Iota(static_cast<T>(0), length);
4551
}
4652

47-
/// Create a vector containing the values from start with length elements
48-
template <typename T>
49-
std::vector<T> Iota(T start, size_t length) {
50-
std::vector<T> result(length);
51-
std::iota(result.begin(), result.end(), start);
52-
return result;
53-
}
54-
5553
/// Create a range from a callable which takes a single index parameter
5654
/// and returns the value of iterator on each call and a length.
5755
/// Only iterators obtained from the same range should be compared, the

0 commit comments

Comments
 (0)