For example both languages offer a way to represent a dynamic sequence of elements of the same type stored next to each other. That’s std::vector in C++ or std::Vec in Rust. Both define a vector as a pointer to some memory, a capacity and a length. But what type does the pointer have? How does the data pointed to need to be aligned in memory? What type represents capacity and length? In which sequence are pointer, capacity and length stored?
I wonder if anyone considered providing a custom C++ standard library implementation that maps directly into the corresponding Rust type representations. Such an implementation could also maintain Rust invariants, e.g., that std::string always contains valid UTF-8.
I wonder if anyone considered providing a custom C++ standard library implementation that maps directly into the corresponding Rust type representations. Such an implementation could also maintain Rust invariants, e.g., that
std::string
always contains valid UTF-8.