On 03/22/2014 06:03 PM, Jay Norwood wrote:
> derr.writefln("time: ", sw.peek().msecs, "[ms]");
Cool. stderr should work too:
stderr.writefln(/* ... */);
Ali
I decided to redirect stdout to nul and print the stopwatch
messages to stderr.
So, basically like this.
import std.stdio;
import std.datetime;
import std.cstream;
StopWatch sw;
sw.start();
measured code
sw.stop();
derr.writefln("time: ", sw.peek().msecs, "[ms]");
Then, windows results compa
On Saturday, 22 March 2014 at 22:54:15 UTC, captaindet wrote:
pls see example code below.
the two 'test' templates work fine by themselves. if, however,
in the same module, the eponymous template does not work
anymore. instead the compiler seems to try instantiating the
variadic template.
a
pls see example code below.
the two 'test' templates work fine by themselves. if, however, in the same
module, the eponymous template does not work anymore. instead the compiler
seems to try instantiating the variadic template.
a) why? for how i understand it, this should not happen as
o they
The computation times of different methods can differ a lot.
How do you suggest to measure this effectively without the
overhead of the write and writeln output? Would a count of
11 and stubs like below be reasonable, or would there be
something else that would prevent the optimizer fr
This will work:
import core.thread;
void main() {
Thread.sleep(5.seconds);
}
sleep is a member of Thread, but it is static so you can easily
call it to sleep the current thread.
The argument is a Duration, which is most easily constructed with
the .seconds, .msecs, .minutes, etc. help
import core.thread;
void main() {
}
Hello,
I know there are severel threads concerning "Wait", "Pause",
"Sleep", a.s.o
but most of them were created in 2007 or similiar. It seems D has
changed a lot because when I try to call sleep/msleep (example),
the compiler cannot find it (ERROR: undefined indentifier).
import std.stdio;
On Friday, 14 March 2014 at 19:24:21 UTC, Chris Williams wrote:
In D, an array is a struct (struct Array), with an address and
a length value. A multi-dimensional array is an Array with an
address pointing to an array of Arrays. So with an int[2][2]
array, you have a layout like:
@1000 Array(
Nordlöw:
I cracked it:
This is important stuff. So if you find that you can't do
something in D, consider asking for it in the main D newsgroup
and in Bugzilla.
Bye,
bearophile
MarisaLovesUsAll:
Hi! I need to use array of bits in my custom class. I tried to
add std.bitmanip.BitArray as field, but got a strange error.
What
am I doing wrong?
import std.bitmanip;
class Scene
{
BitArray collisionMap;
this(int w, int h)
{
collisionMap.init([0,0,0]
Luís Marques:
It would swap elements, like sort, so it doesn't need to put
them anywhere, just permute them. The advantage is this:
Input: [7, 3, 7, 1, 1, 1, 1]
Output sort: [1, 1, 1, 1, 3, 7, 7]
Output groupSort: [3, 7, 7, 1, 1, 1, 1]
I think to swap items it must know where to swap them to
Hi! I need to use array of bits in my custom class. I tried to
add std.bitmanip.BitArray as field, but got a strange error. What
am I doing wrong?
import std.bitmanip;
class Scene
{
BitArray collisionMap;
this(int w, int h)
{
collisionMap.init([0,0,0]);
}
}
C:\D\dmd2
13 matches
Mail list logo