]> git.lizzy.rs Git - rust.git/commit
vec: Add .pop_opt() -> Option<T>
authorblake2-ppc <blake2-ppc>
Fri, 5 Jul 2013 18:32:25 +0000 (20:32 +0200)
committerblake2-ppc <blake2-ppc>
Fri, 5 Jul 2013 18:32:25 +0000 (20:32 +0200)
commitd805b832f5a49acc66e0d2acda9f9f4cf074a374
treef4c3826d7daabed5c8ad8ed9fc4b4e9a0278fc7d
parent58eb70a5e2ce6602e5685f5cc18ab2fe0c327020
vec: Add .pop_opt() -> Option<T>

Add a function to safely retrieve the last element of a ~[T], as
Option<T>. Implement pop() using pop_opt(); it benches the same as the
old implementation when tested with optimization level 2.
src/libstd/vec.rs