2011-06-15 11:19:50 -07:00
|
|
|
|
|
|
|
|
2011-07-27 14:19:39 +02:00
|
|
|
type box[T] = {c: @T};
|
2010-06-23 21:03:09 -07:00
|
|
|
|
2011-07-27 14:19:39 +02:00
|
|
|
fn unbox[T](b: &box[T]) -> T { ret *b.c; }
|
2010-06-23 21:03:09 -07:00
|
|
|
|
|
|
|
fn main() {
|
2011-07-27 14:19:39 +02:00
|
|
|
let foo: int = 17;
|
|
|
|
let bfoo: box[int] = {c: @foo};
|
2011-06-15 11:19:50 -07:00
|
|
|
log "see what's in our box";
|
|
|
|
assert (unbox[int](bfoo) == foo);
|
|
|
|
}
|