4 ms·
But then it’s no longer a plain struct, rather a struct plus a pointer to the trait object. Which is perfectly doable in C++ too.
by aaaaaaaaaaab 8y ago
But then it’s no longer a plain struct, rather a struct plus a pointer to the trait object.
Which is perfectly doable in C++ too.
- steveklabnik 8y agoThe struct is a plain struct; just like an int is an int and a int* is a pointer, a struct is a struct and a trait object is a pointer. (It’s a double pointer: a pointer to that struct and a pointer to the vtable)