"temporary" templates
Suleyman
sahmi.soulaimane at gmail.com
Mon Dec 2 01:50:34 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
It can work with some declarations I don't to what extend though
since __traits(isSame) does a range of comparisons depending on
the arguments. But string manipulation with CTFE is not cheap
either. Here is a challenge for you, try to make a string with
CTFE that has 1 million times the word int separated by a comma
like "int, int, int, ..." in under 4GB of memory use if you can
go below 4GB then lower the bar from there to 1.5GB.
More information about the Digitalmars-d
mailing list