mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
modifiers and with the func implementations of the operators. This resolves the rest of: <rdar://problem/17527000> change operator declarations from "operator prefix" to "prefix operator" & make operator a keyword Swift SVN r19931
17 lines
284 B
Swift
17 lines
284 B
Swift
public struct SpecialInt {
|
|
public var value = 0
|
|
public init() {}
|
|
}
|
|
|
|
prefix operator +++ {}
|
|
postfix operator +++ {}
|
|
|
|
prefix public func +++(inout base: SpecialInt) {
|
|
base.value += 2
|
|
}
|
|
|
|
postfix public func +++(inout base: SpecialInt) {
|
|
println("use the prefix form instead")
|
|
}
|
|
|