Thread overview
from C++ to D...
Jun 14, 2004
Regan Heath
Jun 14, 2004
Sam McCall
Jun 14, 2004
Regan Heath
Jun 14, 2004
Walter
Jun 14, 2004
Matthew
June 14, 2004
This is a C++ struct..

struct bob
{
	void check1(void *blert) {
		..etc..
	}

	void (bob::*check2(void *blart))(void *) {
		..etc..
		return check1;
	}
};

how do I write that in D?

It is a function that takes a void * and returns a function that takes a void *

I know I use delegate, but how. :)

Thanks in advance.

Regan

-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
June 14, 2004
Regan Heath wrote:

> This is a C++ struct..
> 
> struct bob
> {
>     void check1(void *blert) {
>         ..etc..
>     }
> 
>     void (bob::*check2(void *blart))(void *) {
>         ..etc..
>         return check1;
>     }
> };
> 
> how do I write that in D?

struct bob {
	void check1(void* blert) {
	}
	void delegate(void *) check2(void* blart) {
		return &check1;
	}
}
I think that's right... much easier on the eyes :-)
Sam
June 14, 2004
On Mon, 14 Jun 2004 17:49:40 +1200, Sam McCall <tunah.d@tunah.net> wrote:
> Regan Heath wrote:
>
>> This is a C++ struct..
>>
>> struct bob
>> {
>>     void check1(void *blert) {
>>         ..etc..
>>     }
>>
>>     void (bob::*check2(void *blart))(void *) {
>>         ..etc..
>>         return check1;
>>     }
>> };
>>
>> how do I write that in D?
>
> struct bob {
> 	void check1(void* blert) {
> 	}
> 	void delegate(void *) check2(void* blart) {
> 		return &check1;
> 	}
> }
> I think that's right... much easier on the eyes :-)

Thanks. :)

I should have worked it out, for some reason I just couldn't my brain is still programmed for C/C++ I'm afraid.

Regan

-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
June 14, 2004
"Regan Heath" <regan@netwin.co.nz> wrote in message news:opr9kmlcn75a2sq9@digitalmars.com...
> I should have worked it out, for some reason I just couldn't my brain is still programmed for C/C++ I'm afraid.

At some point, you'll find you can't go back to C++ <g>.


June 14, 2004
"Walter" <newshound@digitalmars.com> wrote in message news:cajj1r$2sqp$1@digitaldaemon.com...
>
> "Regan Heath" <regan@netwin.co.nz> wrote in message news:opr9kmlcn75a2sq9@digitalmars.com...
> > I should have worked it out, for some reason I just couldn't my brain is still programmed for C/C++ I'm afraid.
>
> At some point, you'll find you can't go back to C++ <g>.

When's that then? <g>

I have to say, though, that I've been inspired by D to introduce various things into C++ libraries to give the same functionality.