Created
December 8, 2021 05:30
-
-
Save tgnivekucn/7e6576cd46df2fcff97f55929b50684e to your computer and use it in GitHub Desktop.
Part of Optional.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum Optional<Wrapped>: ExpressibleByNilLiteral { | |
case none | |
case some(Wrapped) | |
public init(_ some: Wrapped) { self = .some(some) } | |
public init(nilLiteral: ()) { | |
self = .none | |
} | |
@inlinable | |
public static func ==(lhs: Wrapped?, rhs: Wrapped?) -> Bool { | |
switch (lhs, rhs) { | |
case let (l?, r?): | |
return l == r | |
case (nil, nil): | |
return true | |
default: | |
return false | |
} | |
} | |
..... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment