|
|
|
|
|
by drmikeando
106 days ago
|
|
While this is a great article, I feels it buries the lede. For me, the key insight was from the last paragraph of the article: C++23 introduces "deducing this", which is a way to avoid the performance
cost of dynamic dispatch without needing to use tricks like CRRT, by writing: class Base {
public:
auto foo(this auto&& self) -> int { return 77 + self.bar(); }
};
class Derived : public Base {
public:
auto bar() -> int { return 88; }
};
I wish the article had gone into more details on how this works and when you can use it, and what its limitations are. |
|