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
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
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.
*closest
I'm tired. :/
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",
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
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
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
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
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.
Daniel Murphy:
> Looks like a bug. Please file.
http://d.puremagic.com/issues/show_bug.cgi?id=6257
Bye,
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
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
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
14 matches
Mail list logo