Anyone have a function to print out the field name and its value?
Andrej Mitrovic
andrej.mitrovich at gmail.com
Sat Apr 9 10:44:29 PDT 2011
On 4/9/11, Andrej Mitrovic <andrej.mitrovich at gmail.com> wrote:
> That's great, I can use it to print out all the fields. Thanks!
Some error checking should be done, or maybe there's a bug. If a field
has a type that is a typedef to say a void*:
typedef void* HANDLE
struct S
{
HANDLE hnd;
}
Printing hnd will fail with an error:
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\format.d(1599): Error:
function std.format.formatValue!(LockingTextWriter,HANDLE,immutable(char)).formatValue
is deprecated
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\format.d(308): Error:
template instance
std.format.formatGeneric!(LockingTextWriter,HANDLE,immutable(char))
error instantiating
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\stdio.d(701):
instantiated from here:
formattedWrite!(LockingTextWriter,immutable(char),HANDLE)
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\stdio.d(1598): instantiated
from here: writefln!(string,HANDLE)
hello_msg.d(35): instantiated from here: writefln!(string,HANDLE)
hello_msg.d(129): instantiated from here: print!(PAINTSTRUCT)
Btw, why are we not allowed to have mixin templates that have
statements? Why only declarations?
More information about the Digitalmars-d-learn
mailing list