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 <[email protected]> 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
