|
|
|
|
|
by codedokode
1477 days ago
|
|
You are right. First version of code actually used std::shared_ptr<Data>(new Data) (and produced similar code), but then I thought that it is unfair that we create a struct on a stack in Rust, so I changed the code. I should have used gcc with -Wall that detects the problem (clang doesn't). |
|
e.g nt_shared_ptr<Data> x(&d, [](Data*) -> void{});
https://godbolt.org/z/d3qv4cE1v