3 ms·
In C++ and Rust, there's a single vtable per class (trait), not per object. (This is basically why Rust doesn't support multi-trait types (e.g. &dyn Debug + Cl
by richardwhiuk 6y ago
In C++ and Rust, there's a single vtable per class (trait), not per object.
(This is basically why Rust doesn't support multi-trait types (e.g. &dyn Debug + Clone)
- estebank 6y agoYou can accomplish the same behavior by having a marker trait: trait Foo: Debug + Clone {} Edit: No you can't, because `Clone` requires `Sized`, which means you can't make a trait object of `Foo`. https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=252fbe402fe80be54816667afc5c62f3 https://play.rust-lang.org/?version=stable&mode=debug&editio...