Created
July 30, 2014 14:41
-
-
Save MatejLach/d7b8c26f43301810e77b to your computer and use it in GitHub Desktop.
An owned Rust pointer example...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let b = box 15i; // `b` is the single owner of this `Box<int>` | |
let c = &b; // I can have a reference to `b` | |
println!("{}", c); // Unlike C++, Rust doesn't require dereferencing here | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment