Rowe Wilson Frederisk Holme
Rowe Wilson Frederisk Holme
I wrote [a rough benchmark](https://gist.github.com/Frederisk/6b5ef3c70dd0b74d663619cc91b73634), and it seems that the generic version does achieve the same effect while having higher performance. Of course this test is very simple, if anyone...
Another question is whether we need to replace `LifetimeEntryManager` in some existing classes with generic versions? For example, `LifetimeManagementContainer` or `PooledDrawableWithLifetimeContainer` in osu!.
> Performance is not a factor here. The "gains" above are negligible at best, if not straight up just measurement error. Yeah, just making sure I don't run into new...
I don't quite understand how I should provide a preview, do I need to open another PR in the repo of osu!?
I tried to modify `PooledDrawableWithLifetimeContainer` in osu! to the expected generic type as [an example](https://github.com/Frederisk/osu/commit/e39d923d025155f3e5c6d654e07153247dbe5023). Because of the nested relationships between many classes, modifications can appear piecemeal. Finding other classes...
I understand that CRTP has caused confusion for someone, so please allow me to provide some clarification here: What is CRTP: CRTP is a trick but not a hack. It...
But the comments above just now reminded me that maybe I should give `LifetimeEntry` a new name, such as `LifetimeEntryBase`, to make the code clearer. Or any other ideas?🤔
Well, I respect your opinion. I regret that we did not reach a consensus.🥲 But in fact, users of these two classes don't even need to understand how they work....
As a fact, CRTP is a trick that is already used in .NET. For example: [IAdditionOperators](https://learn.microsoft.com/en-us/dotnet/api/system.numerics.iadditionoperators-3?view=net-8.0): ```cs public interface IAdditionOperators where TSelf : IAdditionOperators ```
First try `Ctrl+Shift+P` and then choose `Wikitext:Login`. Then perform a preview. This should solve the problem.