Re: Const/Immutable Slicing Syntax

2016-11-22 Thread Jack Applegame via Digitalmars-d-learn

cast(const) x[];
cast(immutable) x[];



Const/Immutable Slicing Syntax

2016-11-22 Thread Nordlöw via Digitalmars-d-learn

What's the cleanest way of doing const or immutable slicing in D?

My first thought is

cast((const typeof(x))x)[]
cast((immutable typeof(x))x)[]

but that's too verbose for my/taste.

Is there a Phobos function for this?