Cannot use function as foreach aggregate.

Daniel Keep daniel.keep.lists at gmail.com
Wed Apr 4 06:04:26 PDT 2007


So, I've just discovered that you can't use function pointers as the
aggregate of a foreach.  To put it mildly: this sucks.

Basically I have a bunch of module-level functions used to iterate over
some global state private to that module.  So, two questions:

1. Is this a bug?  If it's not, why can we use delegates but not
function pointers?

2. What's the cleanest way to wrap a function pointer in a delegate?

	-- Daniel

-- 
int getRandomNumber()
{
    return 4; // chosen by fair dice roll.
              // guaranteed to be random.
}

http://xkcd.com/

v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP  http://hackerkey.com/



More information about the Digitalmars-d mailing list