On Sunday, 14 January 2018 at 02:24:52 UTC, Adam D. Ruppe wrote:
On Sunday, 14 January 2018 at 02:14:50 UTC, Jonathan M Davis
wrote:
If you're using template constraints rather than template
specializations, then you can't have any unconstrained
templates.
Not true: see the tip of the week he
On Saturday, January 13, 2018 19:32:06 Jonathan M Davis via Digitalmars-d-
learn wrote:
> On Sunday, January 14, 2018 02:24:52 Adam D. Ruppe via Digitalmars-d-learn
> wrote:
> > On Sunday, 14 January 2018 at 02:14:50 UTC, Jonathan M Davis
> >
> > wrote:
> > > If you're using template constraints ra
On Sunday, 14 January 2018 at 00:09:42 UTC, kdevel wrote:
The compiler does not allow me to specialize the primary
function template for double:
Yes, it does., and it works for float and double. Just `real`
matches both equally, so that's the error for that type. Let me
quote the spec:
http
On Sunday, January 14, 2018 02:24:52 Adam D. Ruppe via Digitalmars-d-learn
wrote:
> On Sunday, 14 January 2018 at 02:14:50 UTC, Jonathan M Davis
>
> wrote:
> > If you're using template constraints rather than template
> > specializations, then you can't have any unconstrained
> > templates.
>
> No
On Sunday, 14 January 2018 at 02:14:50 UTC, Jonathan M Davis
wrote:
If you're using template constraints rather than template
specializations, then you can't have any unconstrained
templates.
Not true: see the tip of the week here
http://arsdnet.net/this-week-in-d/2016-sep-04.html
On Sunday, January 14, 2018 01:02:46 kdevel via Digitalmars-d-learn wrote:
> On Sunday, 14 January 2018 at 00:30:37 UTC, Nicholas Wilson wrote:
> > The usual way to do what you are trying to do is with template
> > constraints.
> >
> > void foo(T)() if (is(T== float)) { ...}
>
> Thanks. That works
On Sunday, 14 January 2018 at 00:30:37 UTC, Nicholas Wilson wrote:
The usual way to do what you are trying to do is with template
constraints.
void foo(T)() if (is(T== float)) { ...}
Thanks. That works but looks a bit ugly. Am I right that I have
to leave out the primary (unconstrained) temp
On Sunday, 14 January 2018 at 00:09:42 UTC, kdevel wrote:
fusp.d
```
import std.stdio;
import std.typecons;
void foo (T) ()
{
writeln ("(1) foo T = ", T.stringof);
}
void foo (T : float) ()
{
writeln ("(2) foo T = ", T.stringof);
}
// void foo (T : double) ()
// {
//writeln ("(2) foo
fusp.d
```
import std.stdio;
import std.typecons;
void foo (T) ()
{
writeln ("(1) foo T = ", T.stringof);
}
void foo (T : float) ()
{
writeln ("(2) foo T = ", T.stringof);
}
// void foo (T : double) ()
// {
//writeln ("(2) foo T = ", T.stringof);
// }
void main ()
{
foo!float;