Traits mega template

monkyyy crazymonkyyy at gmail.com
Sun Aug 10 16:27:00 UTC 2025


On Sunday, 10 August 2025 at 16:20:49 UTC, Per Nordlöw wrote:
> On Saturday, 9 August 2025 at 17:16:21 UTC, monkyyy wrote:
>> would a single mega template lib of traits bullshit be more 
>> wildly more compile time and usable efficient then phoboes 
>> isBlahBlahBlah?
>> when a isBidirectionalRange || isRandomAccess range is called,
>
> All of Phobos's traits should be transcoded to builtin __traits 
> for performance reasons. Using templates to implement traits is 
> an anti-pattern both in D and C++ as templates are too costly 
> and design for this purpose. This is how C++ does it. The C++ 
> standard makes this a requirement for compiler implementations. 
> The reason is performance. Until D has type functions that is.

Thats not always possible, header `if` resolve to an expression 
and there are questions that are iterative such as all the 
listing the members of a struct and finding some function inside 
matches


More information about the Digitalmars-d mailing list