On 2011-07-07 04:47, Andrej Mitrovic wrote:
void foo(){};
void bar(){};

void main()
{
     auto funcs = [&foo,&bar];
}

I'm using this in a foreach loop and invoking each function with some
predefined arguments. But I'd also like to extract the name of each
function because each function does some image processing and then I
save that image to disk.

Basically I want to do:

     foreach (func; funcs)
     {
         func(arguments..);
         writeToFile(func.stringof);
     }

Obviously I can't use arrays since they don't hold any name
information, they just store the pointers.

Can I use tuples somehow? The functions are predefined, I just need to
iterate through all of them and call them and extract their name.

template functionNameOf (alias func)
{
    enum functionNameOf = (&func).stringof[2 .. $];
}

--
/Jacob Carlborg

Reply via email to