"temporary" templates

Petar Petar
Mon Dec 2 07:18:32 UTC 2019


On Monday, 2 December 2019 at 01:10:26 UTC, Steven Schveighoffer 
wrote:
> On 12/1/19 4:04 PM, Suleyman wrote:
>> Perhaps this is the opportunity to make a good runtime 
>> reflection system. We have typeid() for types, for an alias 
>> sequence which contains only types an no declarations we can 
>> implement NoDuplicates as a function that takes a TypeInfo[] 
>> and return the array with no duplicates in it, but we need a 
>> way to get a compile-time type from a TypeInfo, sort of a 
>> reversed typeid()
> I actually figured out a Type-only mechanism to CTFE a 
> NoDuplicates list. Translate each type into a string name, then 
> no-dup the string array, creating a string of AliasSeq 
> references, then mixin the result.
>
> But having CTFE actually give me the types to translate back 
> into an AliasSeq list would be so much better.
>
> -Steve

I had a similar idea for optimizing NoDuplicates, as used by 
std.typecons.Tuple:

https://github.com/dlang/phobos/pull/5725#issuecomment-327767020

;)



More information about the Digitalmars-d mailing list