@@ -409,28 +409,6 @@ extension SetAlgebra {
409
409
for e in sequence { insert ( e) }
410
410
}
411
411
412
- /// Creates a set containing the elements of the given array literal.
413
- ///
414
- /// Do not call this initializer directly. It is used by the compiler when
415
- /// you use an array literal. Instead, create a new set using an array
416
- /// literal as its value by enclosing a comma-separated list of values in
417
- /// square brackets. You can use an array literal anywhere a set is expected
418
- /// by the type context.
419
- ///
420
- /// Here, a set of strings is created from an array literal holding only
421
- /// strings:
422
- ///
423
- /// let ingredients: Set = ["cocoa beans", "sugar", "cocoa butter", "salt"]
424
- /// if ingredients.isSuperset(of: ["sugar", "salt"]) {
425
- /// print("Whatever it is, it's bound to be delicious!")
426
- /// }
427
- /// // Prints "Whatever it is, it's bound to be delicious!"
428
- ///
429
- /// - Parameter arrayLiteral: A list of elements of the new set.
430
- public init ( arrayLiteral: Element ... ) {
431
- self . init ( arrayLiteral)
432
- }
433
-
434
412
/// Removes the elements of the given set from this set.
435
413
///
436
414
/// In the following example, the elements of the `employees` set that are
@@ -571,6 +549,30 @@ extension SetAlgebra {
571
549
}
572
550
}
573
551
552
+ extension SetAlgebra where Element == ArrayLiteralElement {
553
+ /// Creates a set containing the elements of the given array literal.
554
+ ///
555
+ /// Do not call this initializer directly. It is used by the compiler when
556
+ /// you use an array literal. Instead, create a new set using an array
557
+ /// literal as its value by enclosing a comma-separated list of values in
558
+ /// square brackets. You can use an array literal anywhere a set is expected
559
+ /// by the type context.
560
+ ///
561
+ /// Here, a set of strings is created from an array literal holding only
562
+ /// strings:
563
+ ///
564
+ /// let ingredients: Set = ["cocoa beans", "sugar", "cocoa butter", "salt"]
565
+ /// if ingredients.isSuperset(of: ["sugar", "salt"]) {
566
+ /// print("Whatever it is, it's bound to be delicious!")
567
+ /// }
568
+ /// // Prints "Whatever it is, it's bound to be delicious!"
569
+ ///
570
+ /// - Parameter arrayLiteral: A list of elements of the new set.
571
+ public init ( arrayLiteral: Element ... ) {
572
+ self . init ( arrayLiteral)
573
+ }
574
+ }
575
+
574
576
@available ( * , unavailable, renamed: " SetAlgebra " )
575
577
public typealias SetAlgebraType = SetAlgebra
576
578
0 commit comments