@@ -87,20 +87,6 @@ proc initDeque*[T](initialSize: int = defaultInitialSize): Deque[T] =
87
87
# # * `toDeque proc <#toDeque,openArray[T]>`_
88
88
result .initImpl (initialSize)
89
89
90
- proc toDeque * [T](x: openArray [T]): Deque [T] {.since : (1 , 3 ).} =
91
- # # Creates a new deque that contains the elements of `x` (in the same order).
92
- # #
93
- # # **See also:**
94
- # # * `initDeque proc <#initDeque,int>`_
95
- runnableExamples:
96
- let a = toDeque ([7 , 8 , 9 ])
97
- assert len (a) == 3
98
- assert $ a == " [7, 8, 9]"
99
-
100
- result .initImpl (x.len)
101
- for item in items (x):
102
- result .addLast (item)
103
-
104
90
proc len * [T](deq: Deque [T]): int {.inline .} =
105
91
# # Returns the number of elements of `deq`.
106
92
result = deq.count
@@ -303,6 +289,20 @@ proc addLast*[T](deq: var Deque[T], item: sink T) =
303
289
deq.data[deq.tail] = item
304
290
deq.tail = (deq.tail + 1 ) and deq.mask
305
291
292
+ proc toDeque * [T](x: openArray [T]): Deque [T] {.since : (1 , 3 ).} =
293
+ # # Creates a new deque that contains the elements of `x` (in the same order).
294
+ # #
295
+ # # **See also:**
296
+ # # * `initDeque proc <#initDeque,int>`_
297
+ runnableExamples:
298
+ let a = toDeque ([7 , 8 , 9 ])
299
+ assert len (a) == 3
300
+ assert $ a == " [7, 8, 9]"
301
+
302
+ result .initImpl (x.len)
303
+ for item in items (x):
304
+ result .addLast (item)
305
+
306
306
proc peekFirst * [T](deq: Deque [T]): lent T {.inline .} =
307
307
# # Returns the first element of `deq`, but does not remove it from the deque.
308
308
# #
0 commit comments