On 2016-02-11 05:34, Adam D. Ruppe wrote:
On Thursday, 11 February 2016 at 04:31:12 UTC, cy wrote:
as[0..$] = new A();
before accessing .stuff on as[0].
Loop through it and allocate each one rather than trying to do it in a
one liner like that.
What about this?
as[] = new A();
Or will
Oh pardon the constructor I was playing with as a learning
experience and forgot to get rid of.
On Thursday, 11 February 2016 at 07:41:55 UTC, Enjoys Math wrote:
If I just type out sqrt(2.0) in D, is that automatically made
into a constant for me?
Thanks.
for DMD -O :
import std.math;
immutable foo = sqrt(2.0);
pure float precalculated()
{
return foo;
}
pure float
On 02/11/2016 04:44 AM, pineapple wrote:
It feels like there should be an out-of-the box way to do this but I
haven't been able to find it? Help?
This is the thing that I want to do:
struct example{
const string str;
//this(string str){ this.str = str; }
string toString(){
Hello,
I come from the C world and try to do some procedural terrain
generation, and I thought ndslice would help me to make things
look clean, but I'm very new to those semantics and I need help.
Here's my problem: I have a C-style rough implementation of a
function drawing a disk into a
On Thursday, 11 February 2016 at 04:20:13 UTC, tsbockman wrote:
On Thursday, 11 February 2016 at 03:09:51 UTC, rcorre wrote:
I recently tried compiling enumap with GDC, and found that it
disagrees with DMD on whether a function is @nogc. Here's a
semi-reduced test-case:
Here's an @nogc
On Thursday, 11 February 2016 at 12:44:15 UTC, pineapple wrote:
It feels like there should be an out-of-the box way to do this
but I haven't been able to find it? Help?
This is the thing that I want to do:
struct example{
const string str;
//this(string str){ this.str = str; }
On Thursday, 11 February 2016 at 12:41:16 UTC, rcorre wrote:
On Thursday, 11 February 2016 at 04:20:13 UTC, tsbockman wrote:
Using zip and slices guarantees that the structure returned
will be only 5*size_t.sizeof bytes, regardless of the types of
K and V.
I'm on the DMD 2.070 release, so
On Thursday, 11 February 2016 at 07:41:55 UTC, Enjoys Math wrote:
If I just type out sqrt(2.0) in D, is that automatically made
into a constant for me?
Thanks.
For GDC the answer is yes:
It feels like there should be an out-of-the box way to do this
but I haven't been able to find it? Help?
This is the thing that I want to do:
struct example{
const string str;
//this(string str){ this.str = str; }
string toString(){
return this.str;
}
}
public void
On Thursday, 11 February 2016 at 12:53:20 UTC, Edwin van Leeuwen
wrote:
I'd do it like this:
import std.algorithm : map;
pars.map!((part) => part.toString) // Turn them to strings
.join(" ").writeln; // Join them.
Thanks! Does the map function iterate without constructing an
extra list
On Thursday, 11 February 2016 at 13:43:49 UTC, pineapple wrote:
Thanks! Does the map function iterate without constructing an
extra list in-memory?
Yes, it is lazy, so it only calls toString when the result is
actually used (by the join call).
In case you do need to create an extra list
On Thursday, 11 February 2016 at 12:55:02 UTC, rcorre wrote:
Though it appears (in 2.070 at least) that zip's range
primitives aren't nogc:
I took a look at the source code for `zip()`, and the cause of
this deficiency is that `Zip` takes a `StoppingPolicy` as a
runtime parameter, rather
On Thursday, 11 February 2016 at 13:05:41 UTC, Claude wrote:
Hello,
I come from the C world and try to do some procedural terrain
generation, and I thought ndslice would help me to make things
look clean, but I'm very new to those semantics and I need help.
Here's my problem: I have a
On 02/11/2016 05:05 AM, Claude wrote:
Hello,
I come from the C world and try to do some procedural terrain
generation, and I thought ndslice would help me to make things look
clean, but I'm very new to those semantics and I need help.
Here's my problem: I have a C-style rough implementation of
On Thursday, 11 February 2016 at 12:53:20 UTC, Edwin van Leeuwen
wrote:
I'd do it like this:
import std.algorithm : map;
pars.map!((part) => part.toString) // Turn them to strings
.join(" ").writeln; // Join them.
You can shorten this by using std.conv.to. Also keep in mind that
`join` will
On Thursday, 11 February 2016 at 09:02:30 UTC, Jacob Carlborg
wrote:
On 2016-02-11 05:34, Adam D. Ruppe wrote:
On Thursday, 11 February 2016 at 04:31:12 UTC, cy wrote:
as[0..$] = new A();
before accessing .stuff on as[0].
Loop through it and allocate each one rather than trying to do
it in
17 matches
Mail list logo