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