cast overly permissive with extern(C++ ) classes; should cast through `void*`
Timothee Cour
thelastmammoth at gmail.com
Tue Feb 6 23:31:06 UTC 2018
assumeUnique has a very specific use case; i was describing a more
general way to handle various types of cast (and be explicit about
whats allowed) as mentioned above
On Tue, Feb 6, 2018 at 3:18 PM, Seb via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On Tuesday, 6 February 2018 at 23:15:07 UTC, Timothee Cour wrote:
>>>
>>> Like assumeUnique?
>>
>> https://dlang.org/library/std/exception/assume_unique.html
>>
>> what do you mean? u mean adding "unique" to the DSL list ? maybe!
>
>
>
> You asked: Actually how about introducing a library solution for explicit
> casting.
> That's why I thought about the existing assumeUnique:
>
>
> ```
> immutable(T)[] assumeUnique(T)(ref T[] array) pure nothrow
> {
> auto result = cast(immutable(T)[]) array;
> array = null;
> return result;
> }
> ```
>
> https://github.com/dlang/phobos/blob/v2.078.1/std/exception.d#L905
More information about the Digitalmars-d
mailing list