Its better to migrate to rust. Instead of copying & implementing these things from other languages.

I agree that ideally everything should be written in safer alternatives, in most scenarios is not feasible to migrate from C++ to another language, because of the code base size.

I think cppfront[0] is the way to go if you want to write a safer language on top of C++, you can watch the talk about it here[1].

[0] https://github.com/hsutter/cppfront [1] https://www.youtube.com/watch?v=ELeZAKCN4tY