Hum Humm, Typedef

Treebeard treebeard at where.org
Sat Nov 30 18:15:47 UTC 2019


Hoom, hum, I met a dark forest of complains from the compilers 
here.

I walk slowly, but I would love typedef and cookies..

"""
import std.datetime, std.typecons;

alias M = Typedef!Duration;
void main()
{
     auto d1 = 100.msecs;
     auto d2 = 110.msecs;
     assert(d1 < d2);

     auto m1 = M(100.msecs);
     auto m2 = M(110.msecs);
     assert(m1 < m2);
}

/dlang/dmd/linux/bin64/../../src/phobos/std/typecons.d(6736): 
Error: template std.typecons.Typedef!(Duration, Duration(0L), 
null).Typedef.Proxy!(Typedef_payload).opCmp cannot deduce 
function from argument types !()(Duration), candidates are:
/dlang/dmd/linux/bin64/../../src/phobos/std/typecons.d(6726):     
    opCmp(this X, B)(auto ref B b)
   with X = Typedef!(Duration, Duration(0L), null),
        B = Duration
   must satisfy one of the following constraints:
        !is(typeof(a.opCmp(b)))
        !is(typeof(b.opCmp(a)))
/dlang/dmd/linux/bin64/../../src/phobos/std/typecons.d(6736): 
Error: template std.typecons.Typedef!(Duration, Duration(0L), 
null).Typedef.Proxy!(Typedef_payload).opCmp cannot deduce 
function from argument types !()(Duration), candidates are:
/dlang/dmd/linux/bin64/../../src/phobos/std/typecons.d(6726):     
    opCmp(this X, B)(auto ref B b)
   with X = Typedef!(Duration, Duration(0L), null),
        B = Duration
   must satisfy one of the following constraints:
        !is(typeof(a.opCmp(b)))
        !is(typeof(b.opCmp(a)))
onlineapp.d(16): Error: template instance 
std.typecons.Typedef!(Duration, Duration(0L), 
null).Typedef.Proxy!(Typedef_payload).opCmp!(Typedef!(Duration, 
Duration(0L), null), Typedef!(Duration, Duration(0L), null)) 
error instantiating
"""




More information about the Digitalmars-d-learn mailing list