KT-3557: with() made it to stdlib

This commit is contained in:
Maxim Shafirov
2013-04-30 12:49:43 +04:00
parent d53e8bbddf
commit 666cc6e688
+5
View File
@@ -51,3 +51,8 @@ public inline fun <A,B> A.to(that: B): Pair<A, B> = Pair(this, that)
Run function f
*/
public inline fun <T> run(f: () -> T) : T = f()
/**
* Execute f with given receiver
*/
public inline fun <T, R> with(receiver: T, f: T.() -> R) : R = receiver.f()