Immutable cannot be casted to const when using pointers

Steven Schveighoffer schveiguy at yahoo.com
Thu Apr 10 07:22:51 PDT 2014


On Wed, 09 Apr 2014 06:25:34 -0400, Jeroen Bollen <jbinero at gmail.com>  
wrote:

> On Tuesday, 8 April 2014 at 21:53:58 UTC, Steven Schveighoffer wrote:
>> The rule of thumb is, 2 or more references deep does not implicitly  
>> convert. One reference deep is OK.
>>
>> -Steve
>
> For some reason I was expecting that to rhyme. :P
>
> Anyways thanks all, makes sense now. Are there any workarounds? The  
> function taking the const int** is external(C) so I'm not sure what to  
> do.

Without knowing more information, it's hard to say.

You can create a temporary:
// immutable(char)** v
const(char)* x = *v;
foo(&x);

-Steve


More information about the Digitalmars-d mailing list