“Concepts driven design” by Kris Jusiak (Meeting C++ 2017) shows “static polymorphism” and “virtual concepts” in future C++ standard: https://www.youtube.com/watch?v=TorW5ekkL_w&t=41m14s
A collage of three slides:
It’s similar to trait generics and trait objects of Rust (C++ gobbles up every feature). One interesting difference is visible near the end, “Small Buffer Optimization - SBO”. I think currently Rust is not designed for that, and this could lead to more heap allocations compared to that future C++ code. There are crates that do this, like:
https://github.com/canndrew/maybe_box
And a similar crate that allows you to store more than the amount of a pointer.
But I think that talk says C++ will always do that Small Buffer Optimization for virtual concepts. So is it a good idea to do it in Rust too?