test if the alias of a template is a literal

Gianni Pisetta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 27 07:45:22 PDT 2016


On Thursday, 27 October 2016 at 14:34:38 UTC, TheFlyingFiddle 
wrote:
> On Thursday, 27 October 2016 at 14:04:23 UTC, Gianni Pisetta 
> wrote:
>> Hi all,
>> but at the moment isStringLiteral will return true even with 
>> variables of type string. So i searched for a metod to check 
>> if an alias is a literal value, but found nothing. Anyone have 
>> any clue on how can be done?
>>
>> Thanks,
>> Gianni Pisetta
>
> Not really understanding your problem. Could you include an 
> example use that is problematic?

Yea, sorry I missed that.
A really stupid example would be

string var;

alias Sequence = Optimize!( "The", " ", "value", " ", "of", " ", 
"var is ", var );

static assert( is( Sequence == AliasSeq!( "The value of var is ", 
var ) ) );

writeln( Sequence );

given that you include the code snippet in the first post.

Thanks, Gianni


More information about the Digitalmars-d-learn mailing list