Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit24523bc

Browse files
committed
* refactored queue
1 parent09325c0 commit24523bc

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

‎Sources/Queue.swift‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public struct Queue<Element>: CustomStringConvertible, Sequence {
8080
:description:Constructor.
8181
*/
8282
publicinit(){
83-
list=DoublyLinkedList<Element>()
83+
list=DoublyLinkedList()
8484
}
8585

8686
//
@@ -89,7 +89,7 @@ public struct Queue<Element>: CustomStringConvertible, Sequence {
8989
//the next value in the sequence of nodes.
9090
//:returns:Queue.Generator
9191
//
92-
publicfunc makeIterator()->Queue.Iterator{
92+
publicfunc makeIterator()->Iterator{
9393
return list.makeIterator()
9494
}
9595

@@ -118,21 +118,21 @@ public struct Queue<Element>: CustomStringConvertible, Sequence {
118118
mutatingpublicfunc removeAll(){
119119
list.removeAll()
120120
}
121-
}
122121

123-
publicfunc+<Element>(lhs:Queue<Element>, rhs:Queue<Element>)->Queue<Element>{
124-
varq=Queue<Element>()
125-
forxin lhs{
126-
q.enqueue(x)
127-
}
128-
forxin rhs{
129-
q.enqueue(x)
130-
}
131-
return q
132-
}
122+
publicstaticfunc+(lhs:Queue, rhs:Queue)->Queue<Element>{
123+
varq=Queue<Element>()
124+
forxin lhs{
125+
q.enqueue(x)
126+
}
127+
forxin rhs{
128+
q.enqueue(x)
129+
}
130+
return q
131+
}
133132

134-
publicfunc+=<Element>(lhs:inoutQueue<Element>, rhs:Queue<Element>){
135-
forxin rhs{
136-
lhs.enqueue(x)
137-
}
133+
publicstaticfunc+=(lhs:inoutQueue, rhs:Queue){
134+
forxin rhs{
135+
lhs.enqueue(x)
136+
}
137+
}
138138
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp