3 ms·
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
by drmikeando 7mo 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.
- dalvrosa 7mo agoThanks for the feedback, I'll consider expanding in a separate post