Detecting value parameter of template instance in "is" expression

Ali Çehreli acehreli at yahoo.com
Thu Dec 5 13:31:44 PST 2013


On 12/05/2013 01:00 PM, Philippe Sigaud wrote:

 > On Thu, Dec 5, 2013 at 9:17 PM, anonymous <anonymous at example.com> wrote:
 >> On Thursday, 5 December 2013 at 20:07:51 UTC, Uranuz wrote:
 >
 >>> How should I define value parameters inside "is" expression to make 
code
 >>> like this working?
 >>
 >>
 >> is( N == Nullable!(T), T ... )
 >
 > Or
 >
 >      is( N == Nullable!(T, nV), T, alias nV )
 >
 > Since nV is most probably an alias template parameter.
 >

But none of those answer what I think the OP is asking: T must be a type 
AND nV must be a value of that type.

I had thought the following to be true (especially the last quoted 
sentence) [1]:

<quote>
is (T : Specifier, TemplateParamList)
is (T == Specifier, TemplateParamList)
is (T identifier : Specifier, TemplateParamList)
is (T identifier == Specifier, TemplateParamList)

These syntaxes allow for more complex cases. identifier may be omitted.

identifier, Specifier, :, and == all have the same meanings as described 
above.

TemplateParamList is both a part of the condition that needs to be 
satisfied and a facility to define additional aliases if the condition 
is indeed satisfied. It works in the same way as template type deduction.
</quote>

If my the last sentence of mine is correct, then this is an 
implementation problem as Uranuz's syntax should work. Although, I don't 
see why my sentence would not be true. It definitely to be so in many 
other uses.

Ali

[1] http://ddili.org/ders/d.en/is_expr.html



More information about the Digitalmars-d-learn mailing list