On 4/15/14, Artur Skawina wrote:
> He obviously meant that you can't get a pointer to the object, that the
> reference points to, just by casting and w/o address-of.
Ah right. I don't do this often so I forgot. The proper code would be:
int* f(ref int r) { return &r; }
On Tuesday, 15 April 2014 at 12:05:09 UTC, Artur Skawina wrote:
He obviously meant that you can't get a pointer to the object,
that the> reference points to, just by casting and w/o
address-of.
Yea, you can cast a class reference to void* (which does include
this inside a class), but not a ref
On 04/15/14 13:30, Andrej Mitrovic wrote:
> On 4/15/14, Artur Skawina wrote:
>> It *is* true. Classes are /reference types/, not references to classes.
>
> I meant the part where he said you can't cast a reference to a pointer. You
> can.
He obviously meant that you can't get a pointer to the o
On 4/15/14, Artur Skawina wrote:
> It *is* true. Classes are /reference types/, not references to classes.
I meant the part where he said you can't cast a reference to a pointer. You can.
On 04/14/14 19:51, Andrej Mitrovic wrote:
> On Monday, 14 April 2014 at 17:48:31 UTC, Adam D. Ruppe wrote:
>> On Monday, 14 April 2014 at 17:45:52 UTC, Ryan Voots wrote:
>>> src/yage/core/misc.d(164): Error: e2ir: cannot cast this of type S to type
>>> void*
>>
>>
>> Try taking the address of this
On Monday, 14 April 2014 at 17:45:52 UTC, Ryan Voots wrote:
/**
* Convert any function pointer to a delegate.
* _ From: http://www.digitalmars.com/d/archives/digitalmars
You can replaced it with std.functional.toDelegate.
As for its use-case, if some API or function supports only
delegates
On Monday, 14 April 2014 at 17:48:31 UTC, Adam D. Ruppe wrote:
On Monday, 14 April 2014 at 17:45:52 UTC, Ryan Voots wrote:
src/yage/core/misc.d(164): Error: e2ir: cannot cast this of
type S to type void*
Try taking the address of this before casting it. So more like
cast(void*)&this
IIRC i
On Monday, 14 April 2014 at 17:45:52 UTC, Ryan Voots wrote:
src/yage/core/misc.d(164): Error: e2ir: cannot cast this of
type S to type void*
Try taking the address of this before casting it. So more like
cast(void*)&this
IIRC in D1 this was a pointer, whereas in D2 this is a reference.
You