Skip to content

Commit 104b179

Browse files
committed
api: refactor slicing of __jule_Array
1 parent 360cb04 commit 104b179

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

api/array.hpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,11 @@ template <typename Item, __jule_Int N> struct __jule_Array {
5757
if (start == end) {
5858
return __jule_Slice<Item>();
5959
}
60-
6160
__jule_Slice<Item> slice;
6261
slice.alloc_new(0, end - start);
6362
slice._len = slice._cap;
64-
65-
Item *s_it = slice.begin();
66-
__jule_Array<Item, N>::ConstIterator a_it = this->begin() + start;
67-
__jule_Array<Item, N>::ConstIterator a_end = this->begin() + end;
68-
while (a_it < a_end) {
69-
*s_it++ = *a_it++;
70-
}
71-
63+
(void)std::copy(this->begin() + start, this->begin() + end,
64+
slice.begin());
7265
return slice;
7366
}
7467

0 commit comments

Comments
 (0)