On Monday, December 21, 2015 19:54:53 Shriramana Sharma via Digitalmars-d-learn
wrote:
> Thanks all for your replies. One question:
>
> Jonathan M Davis wrote:
> > Alternatively, you can use static if, though you're only dealing
> > with one template in that case. e.g.
>
> But if we wanted to depr
Thanks all for your replies. One question:
Jonathan M Davis wrote:
> Alternatively, you can use static if, though you're only dealing
> with one template in that case. e.g.
But if we wanted to deprecate one of the alternatives, then we necessary
need to declare two templates with the same name a
On Monday, 21 December 2015 at 11:12:10 UTC, Jonathan M Davis
wrote:
On Monday, 21 December 2015 at 11:07:16 UTC, Jonathan M Davis
wrote:
For your example to work with template constraints, the most
straightforward solution would be
void func(T)(T t)
if(!isIntegral!T)
{
writeln(1);
}
On Monday, 21 December 2015 at 11:07:16 UTC, Jonathan M Davis
wrote:
For your example to work with template constraints, the most
straightforward solution would be
void func(T)(T t)
if(!isIntegral!T)
{
writeln(1);
}
void func(T)(T t)
if(isIntegral!T)
{
writeln(2);
}
Alternati
On Monday, December 21, 2015 15:14:20 Shriramana Sharma via Digitalmars-d-learn
wrote:
> Hello. I want to define a template specialization using traits:
>
> import std.stdio, std.traits;
> void func(T)(T t) { writeln(1); }
> void func(T)(T t) if(isIntegral!T) { writeln(2)
On Monday, 21 December 2015 at 09:44:20 UTC, Shriramana Sharma
wrote:
Hello. I want to define a template specialization using traits:
import std.stdio, std.traits;
void func(T)(T t) { writeln(1); }
void func(T)(T t) if(isIntegral!T) { writeln(2); }
void main()
{
func(1);
}
But I'm ge
Hello. I want to define a template specialization using traits:
import std.stdio, std.traits;
void func(T)(T t) { writeln(1); }
void func(T)(T t) if(isIntegral!T) { writeln(2); }
void main()
{
func(1);
}
But I'm getting an error saying that the called function matches both. If it
w