void main()
{
T input(T)()
{}
T input(T : string)()
{}
}
Error message :
isimsiz.d(6): found 'input' when expecting ';' following statement
isimsiz.d(6): found ':' when expecting ')'
isimsiz.d(6): found 'string' when expecting ';' following statement
isimsiz.d(6): found ')'
canalpay:
void main()
{
T input(T)()
{}
T input(T : string)()
{}
}
In D2 you can't define templates inside functions.
Bye,
bearophile
canalpay:
Thanks, But this example works:
void main()
{
T input(T)()
{}
}
Why ?
You are right. Beside allowing nested functions (this is well known), it seems
D2 also accepts the definition (with template constraint too) and instantiation
of simple templates inside
bearophile wrote:
canalpay:
Thanks, But this example works:
void main()
{
T input(T)()
{}
}
Why ?
You are right. Beside allowing nested functions (this is well known), it seems
D2 also accepts the definition (with template constraint too) and instantiation
of simple templates