Skip to content

Commit 24a26a2

Browse files
committed
0: Duplicate constructor on Java changed into a convenience constructor
1 parent 34f81fc commit 24a26a2

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Source/Array.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ public struct Array<T>
5050
}
5151

5252
//public init(items: inout [T]) { // E59 Duplicate constructor with same signature "init(items var items: T[])"
53-
public init(items: [T]) {
54-
self.list = items.list
55-
self.unique = false
53+
public convenience init(items: [T]) {
54+
var litems = items;
55+
self = init(copy: &litems);
5656
makeUnique() // workaorund for not having inout
5757
//self.unique = false
5858
//items.unique = false

Source/Dictionary.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ public struct Dictionary<Key, Value> /*: INSFastEnumeration<T>*/
3232
}
3333

3434
//public init(items: inout [Key:Value]) { // E59 Duplicate constructor with same signature "init(items var items: [Key:Value])"
35-
public init(items: [Key:Value]) {
36-
self.dictionary = items.dictionary
35+
public convenience init(items: [Key:Value]) {
36+
var litems = items;
37+
self = init(copy: &litems)
3738
self.unique = false
3839
makeUnique() // workaorund for not having inout
3940
//items.unique = false

0 commit comments

Comments
 (0)