For instance, if we forget about return value optimization, and have the following code:
fn func() -> Box<String> {
Box::new(String::new())
}
fn main() {
let boxed_string = func();
}
will the compiler create regions to manage the memory or will it use normal heap allocation?
I know this simple code might be optimized, but in a more complex code, it might not be the case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With