Skip to content

Instantly share code, notes, and snippets.

@mtomwing
Created July 17, 2014 03:13
Show Gist options
  • Save mtomwing/85c47944e0ddc7ddc1e3 to your computer and use it in GitHub Desktop.
Save mtomwing/85c47944e0ddc7ddc1e3 to your computer and use it in GitHub Desktop.
fn compare<T:Ord>(a: &T, b: &T) -> int {
if a < b {
-1
}
else if a > b {
1
}
else {
0
}
}
fn main() {
println!("{}", compare(&1u, &2));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment