Both of these options are useful in different situations: #rustlang's is more flexible, but can use more memory, since the pointers are twice as wide. A vector of trait objects in Rust is double the size of a vector of polymorphic objects in #cpp.
With #rustlang's traits, they're implemented as a "fat" pointer: a (pointer to vtable, pointer to data), whereas a pointer to a polymorphic object in #cpp is a thin pointer, and then the object itself contains the pointer to the vtable, with the data following (as I just quoted).
#introduction hi I’m Mohammad. Professionally an MLE but interested in all sorts of things including #MachineLearnning #gamedev #IoT #graphs #rustlangs and whatever else strikes me at the moment.