Re: Any way to get the name of a function?

2011-07-06 Thread Jacob Carlborg
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 so

Re: Any way to get the name of a function?

2011-07-06 Thread Daniel Murphy
Maybe something like TypeTuple!(foo ,bar) will work. "Andrej Mitrovic" wrote in message news:mailman.1452.1310006894.14074.digitalmars-d-le...@puremagic.com... > void foo(){}; > void bar(){}; > > void main() > { >auto funcs = [&foo, &bar]; > } > > I'm using this in a foreach loop and invoki

Re: Any way to get the name of a function?

2011-07-06 Thread Andrej Mitrovic
I could almost do it with string mixins if CTFE didn't suck massive balls.. barely anything works with ctfe, I don't see the use of mixins if i can't use them.

Re: Any way to get the name of a function?

2011-07-06 Thread Andrej Mitrovic
*closest I'm tired. :/

Re: Any way to get the name of a function?

2011-07-06 Thread Andrej Mitrovic
This is the closed I could get: auto funcs = tuple ( [&snippet_text, &snippet_text_extents, &drawStroke, &drawFill, &drawText, &drawTextAlphaBlock, &drawMask, &drawWithSource, &drawWithSource2], ["snippet_text", "snippet_text_extents", "drawStroke", "drawFill", "drawText",

Any way to get the name of a function?

2011-07-06 Thread Andrej Mitrovic
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

Re: Constructor call must be in a constructor

2011-07-06 Thread Jesse Phillips
Loopback Wrote: > Hi! > > While implementing and overloading several different operators for my > structure I've got stuck with an error. > > As noticed in the attachment, in my opBinaryRight function I mimic the > opBinary (left) operator by instantiating the structure itself to avoid > impleme

Constructor call must be in a constructor

2011-07-06 Thread Loopback
Hi! While implementing and overloading several different operators for my structure I've got stuck with an error. As noticed in the attachment, in my opBinaryRight function I mimic the opBinary (left) operator by instantiating the structure itself to avoid implementing duplicates of the binary o

Re: translate a macro to D

2011-07-06 Thread Trass3r
Am 06.07.2011, 16:15 Uhr, schrieb teo : What is the best way to translate following to D? #define MAKELONG(a, b) \ ((LONG) (((WORD) (a)) | ((DWORD) ((WORD) (b))) << 16)) The point is I would like to be able to use that at compile-time. The macro is supposed to define some constants. Just

translate a macro to D

2011-07-06 Thread teo
What is the best way to translate following to D? #define MAKELONG(a, b) \ ((LONG) (((WORD) (a)) | ((DWORD) ((WORD) (b))) << 16)) The point is I would like to be able to use that at compile-time. The macro is supposed to define some constants.

Re: Postblit not called in one case

2011-07-06 Thread bearophile
Daniel Murphy: > Looks like a bug. Please file. http://d.puremagic.com/issues/show_bug.cgi?id=6257 Bye, bearophile

Re: A different vector op

2011-07-06 Thread bearophile
Don: > An interesting use case: > > void main() > { > cdouble[100] foos; > foos[].re = 5.0; > } I don't often have to update arrays of complex numbers, more often I have to set or update a single field of an array of structs. Bye, bearophile

Re: Postblit not called in one case

2011-07-06 Thread Daniel Murphy
Looks like a bug. Please file. "bearophile" wrote in message news:iv0eki$1d8e$1...@digitalmars.com... > With DMD 2.053 the second assert of this program fires, is this a DMD bug > or it's me that's missing something? > > > struct Foo { >int[] data; > >this(int n) { >data.length

Re: A different vector op

2011-07-06 Thread Don
bearophile wrote: Currently this is not allowed, but do you desire a feature like this? struct Foo { int x, y; int[100] array; } void main() { auto foos = new Foo[100]; foos[].y += 10; // *** } Bye, bearophile An interesting use case: void main() { cdouble[100] foos; f