4 ms·
Possibly like this: http://discuss.rust-lang.org/t/pre-rfc-placement-box-with-placer-trait/729 http://discuss.rust-lang.org/t/pre-rfc-placement-box-with-pl...
by pshc 12y ago
Possibly like this: http://discuss.rust-lang.org/t/pre-rfc-placement-box-with-placer-trait/729 http://discuss.rust-lang.org/t/pre-rfc-placement-box-with-pl...
It looks like it'll be supported first-class for 1.0. By my guess we'll be writing things like this:
// NOTE: This is not real code, just a guess on my part!
let heavy_objects: Vec<Heavy> = vec!();
// Construct a new Heavy in-place at the end of the vector.
box(heavy_objects.emplace_back()) Heavy::new();