Hello Jonathan,

On Friday, July 02, 2010 09:46:37 Rob Adelberg wrote:

I'm sure this has come up before, but I want to store something like
an std.array appender in a class.  All of the examples use auto for
the type but you can't put that in a class definition, so what do you
put?

Example:
class packet{...}
class A {

packet []  packetlist;
appender!(packet) packappender;   // wrong format
this () {
packetlist = new packet[0];
packappender = appender(&packetlist);
}
}

What's the format to store the appender in the class?

In this case, the type would be Appender!(packet[]). However, if you
ever want to know the exact type of something, one way to do it is
something like this:

writeln(typeid(appender(&packelist)));

It will print out the type of the expression for you.


or you can get it at compile time:

pragma(msg, typeof(exp).stringof);



- Jonathan M Davis

--
... <IXOYE><



Reply via email to