2011-06-15 11:19:50 -07:00
|
|
|
|
|
|
|
|
2012-01-05 15:35:37 +01:00
|
|
|
type box<T: copy> = {c: @T};
|
2010-06-23 21:03:09 -07:00
|
|
|
|
2012-08-01 17:30:05 -07:00
|
|
|
fn unbox<T: copy>(b: box<T>) -> T { return *b.c; }
|
2010-06-23 21:03:09 -07:00
|
|
|
|
|
|
|
fn main() {
|
2011-07-27 14:19:39 +02:00
|
|
|
let foo: int = 17;
|
2011-08-10 09:27:22 -07:00
|
|
|
let bfoo: box<int> = {c: @foo};
|
2012-07-30 16:01:07 -07:00
|
|
|
debug!{"see what's in our box"};
|
2011-08-13 00:10:18 -07:00
|
|
|
assert (unbox::<int>(bfoo) == foo);
|
2011-08-10 09:27:22 -07:00
|
|
|
}
|