Derived type

novice3 sorryno at em.ail
Tue Mar 30 13:28:55 UTC 2021


Hello.

When i adapt C code, i see new type creation:
   typedef void* Xobj;

Or code like this:
   struct _Xobj;
   typedef struct _Xobj *Xobj;


I want create derived type in D, found std.typecons.Typedef 
template, and write:
   alias Xobj = Typedef!(void*, (void*).init);

But compiler use long type name in error messages, like this:

   Error: function test6.foo(Typedef!(void*, null, null) obj) is 
not callable using argument types (void*)

   cannot pass argument bad of type void* to parameter 
Typedef!(void*, null, null) obj

This messages dont help me understand, which type should i use.
What i should change?
Or Typedef template should be changes?
Any Typedef alternatives?


More information about the Digitalmars-d-learn mailing list