On 12/5/18 12:00 PM, Steven Schveighoffer wrote:
But in cases where you aren't assigning a variable,
float[](1.0, 2.1, 3.5) would be more desirable than casting (since
casting is dangerous).
Sorry, I meant float[]([1.0, 2.1, 3.5])
-Steve
On 12/5/18 5:34 AM, Stanislav Blinov wrote:
On Tuesday, 4 December 2018 at 23:28:42 UTC, H. S. Teoh wrote:
Well OK, for int[] it's kinda silly 'cos that's the default, but in my
code I've often had to write things like:
auto z = cast(float[]) [ 1.0, 2.0, 3.0 ];
Err,
auto z = [ 1.0f,
On Tuesday, 4 December 2018 at 23:28:42 UTC, H. S. Teoh wrote:
Well OK, for int[] it's kinda silly 'cos that's the default,
but in my code I've often had to write things like:
auto z = cast(float[]) [ 1.0, 2.0, 3.0 ];
Err,
auto z = [ 1.0f, 2, 3 ];
?
On Tuesday, 4 December 2018 at 22:35:48 UTC, Jonathan M Davis
wrote:
On Tuesday, December 4, 2018 3:17:04 PM MST jmh530 via
Digitalmars-d-learn wrote:
I've noticed that I can use int like a constructor, as in:
int x = int(1);
but I can't do the same thing with slices
int[] y = int
On Tue, Dec 04, 2018 at 10:17:04PM +, jmh530 via Digitalmars-d-learn wrote:
> I've noticed that I can use int like a constructor, as in:
> int x = int(1);
> but I can't do the same thing with slices
> int[] y = int[]([1, 2]);
>
> Is there somethin
On Tuesday, December 4, 2018 3:17:04 PM MST jmh530 via Digitalmars-d-learn
wrote:
> I've noticed that I can use int like a constructor, as in:
> int x = int(1);
> but I can't do the same thing with slices
> int[] y = int[]([1, 2]);
>
> Is there somethin
I've noticed that I can use int like a constructor, as in:
int x = int(1);
but I can't do the same thing with slices
int[] y = int[]([1, 2]);
Is there something I'm missing here or is this a potential
enhancement? It can make some types of generic code a little more
annoying.