Timeline for Is it possible to achieve Rust's ownership model with a generic C++ wrapper?
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 31, 2019 at 20:46 | comment | added | amon | @ElliotGorokhovsky No, because the template cannot disable core language features such as references. A smart pointer can make it more difficult to get a reference, but at that point you're fighting the language – most standard library functions need references. It is also not possible to check the lifetime of a reference through templates because the language offers no reified concept of lifetime. | |
Aug 31, 2019 at 19:05 | comment | added | Elliot Gorokhovsky | If the issue is that C++ doesn't track ownership in the core language, would it be possible to implement that functionality through meta-programming? Meaning that you would create a new smart pointer class which would be memory safe by (1) forcing it to point exclusively to objects which only use smart pointers from the same class and (2) tracking ownership through templates | |
Dec 24, 2018 at 20:16 | vote | accept | Brannon | ||
Nov 16, 2017 at 22:39 | history | answered | amon | CC BY-SA 3.0 |