On Thursday, 11 June 2015 at 07:57:47 UTC, Per Nordlöw wrote:
On Wednesday, 10 June 2015 at 22:03:52 UTC, Ali Çehreli wrote:
Another option:
void main()
{
auto a2 = new ubyte[5];
But this causes an extra zero-initialization of a2.
a2[] = 0xAA;// -- Assign to all elements
Is
On Thu, 11 Jun 2015 09:01:04 +
Yuxuan Shui via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
A x = scoped!A(10);
use auto x = scoped!A(10);
Whee, $99/year.
Is there a way to encapsulate return value into scoped?
Say I have a function that returns a new object:
X new_x(T t...) {
//Super complex input processing
return new X(something);
}
And I want to encapsulate the result using scoped, is that
possible? Can I just do:
return
On Thursday, 11 June 2015 at 08:48:22 UTC, Yuxuan Shui wrote:
Is there a way to encapsulate return value into scoped?
Say I have a function that returns a new object:
X new_x(T t...) {
//Super complex input processing
return new X(something);
}
And I want to encapsulate the result
On Thursday, 11 June 2015 at 08:33:46 UTC, Daniel Kozák wrote:
On Wed, 10 Jun 2015 20:22:17 +
Adel Mamin via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com
wrote:
ubyte[5] a = 0xAA; // Fine. Five 0xAA bytes.
auto a2 = new ubyte[5]; // Fine. Five 0 bytes.
Now, let's say, I want to
On Wednesday, 10 June 2015 at 18:55:27 UTC, Adam D. Ruppe wrote:
I'm still tempted to grab a used Mac so I can port my display
stuff to Cocoa and test it, but Macs are outrageously expensive
and I hate them, so want to spend as little as possible.
What does dmd minimally require on a mac? If
On Thu, 11 Jun 2015 11:43:25 +
via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
On Thursday, 11 June 2015 at 08:33:46 UTC, Daniel Kozák wrote:
On Wed, 10 Jun 2015 20:22:17 +
Adel Mamin via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com
wrote:
ubyte[5]
On Saturday, 23 May 2015 at 10:58:33 UTC, Kagamin wrote:
On Saturday, 23 May 2015 at 02:36:14 UTC, Dennis Ritchie wrote:
For example, the code in Python looks quite natural:
a = [[int(j) for j in input().split()] for i in range(n)]
About D-code, I can not say:
auto a = stdin
.byLine
On 6/11/15 7:51 AM, Daniel Kozák via Digitalmars-d-learn wrote:
On Thu, 11 Jun 2015 11:43:25 +
via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
On Thursday, 11 June 2015 at 08:33:46 UTC, Daniel Kozák wrote:
On Wed, 10 Jun 2015 20:22:17 +
Adel Mamin via
On Thursday, 11 June 2015 at 09:11:47 UTC, Daniel Kozák wrote:
On Thu, 11 Jun 2015 09:01:04 +
Yuxuan Shui via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com
wrote:
A x = scoped!A(10);
use auto x = scoped!A(10);
Thanks!
Curious question, why doesn't compiler reject
On 6/11/15 1:28 PM, Yuxuan Shui wrote:
On Thursday, 11 June 2015 at 09:11:47 UTC, Daniel Kozák wrote:
On Thu, 11 Jun 2015 09:01:04 +
Yuxuan Shui via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
A x = scoped!A(10);
use auto x = scoped!A(10);
Thanks!
Curious
On Thursday, 11 June 2015 at 17:34:56 UTC, Steven Schveighoffer
wrote:
On 6/11/15 1:28 PM, Yuxuan Shui wrote:
On Thursday, 11 June 2015 at 09:11:47 UTC, Daniel Kozák wrote:
On Thu, 11 Jun 2015 09:01:04 +
Yuxuan Shui via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com
wrote:
A
On 06/11/2015 11:43 AM, Yuxuan Shui wrote:
On Thursday, 11 June 2015 at 17:34:56 UTC, Steven Schveighoffer wrote:
On 6/11/15 1:28 PM, Yuxuan Shui wrote:
On Thursday, 11 June 2015 at 09:11:47 UTC, Daniel Kozák wrote:
On Thu, 11 Jun 2015 09:01:04 +
Yuxuan Shui via Digitalmars-d-learn
On Thursday, 11 June 2015 at 19:23:49 UTC, Ali Çehreli wrote:
On 06/11/2015 11:43 AM, Yuxuan Shui wrote:
On Thursday, 11 June 2015 at 17:34:56 UTC, Steven
Schveighoffer wrote:
On 6/11/15 1:28 PM, Yuxuan Shui wrote:
On Thursday, 11 June 2015 at 09:11:47 UTC, Daniel Kozák
wrote:
On Thu, 11
Hi;
To learn D better and challanging myself I am tring code
computation's with D.
There is a question which is about reading a line of integer
which consist of 20 elements.
My solution fails because Time limit exceeded, I thought it is
because of my algorithm first. I realize time
import std.stdio;
void main()
{
ubyte[] a1 = new ubyte[65];
ubyte[65] a2;
writeln(a1.sizeof = , a1.sizeof); // prints 16
writeln(a2.sizeof = , a2.sizeof); // prints 65
}
Why a1.sizeof is 16?
On Thursday, 11 June 2015 at 20:09:38 UTC, Adel Mamin wrote:
Why a1.sizeof is 16?
sizeof is tied to *type*, not a variable. (I kinda wish a1.sizeof
was prohibited, forcing you to say typeof(a1).sizeof so it is
clear but whatever).
A dynamic array's size is the length variable plus the
On Thursday, 11 June 2015 at 20:09:38 UTC, Adel Mamin wrote:
import std.stdio;
void main()
{
ubyte[] a1 = new ubyte[65];
ubyte[65] a2;
writeln(a1.sizeof = , a1.sizeof); // prints 16
writeln(a2.sizeof = , a2.sizeof); // prints 65
}
Why a1.sizeof is 16?
ubyte[] is a slice,
On Thursday, 11 June 2015 at 07:57:47 UTC, Per Nordlöw wrote:
On Wednesday, 10 June 2015 at 22:03:52 UTC, Ali Çehreli wrote:
Another option:
void main()
{
auto a2 = new ubyte[5];
But this causes an extra zero-initialization of a2.
just an fyi, gdc optimizes this away(looks like it
On Thursday, 11 June 2015 at 19:56:00 UTC, kerdemdemir wrote:
Can I achieve something faster than code below?
auto peopleMoney = stdin.readln().split().map!(a =
to!int(a)).array();
if (peopleMoney.length == 20)
writeln(:();
`std.array.split` is eager. It may be faster if you
On Thursday, 11 June 2015 at 19:56:00 UTC, kerdemdemir wrote:
Hi;
To learn D better and challanging myself I am tring code
computation's with D.
There is a question which is about reading a line of integer
which consist of 20 elements.
My solution fails because Time limit exceeded, I
On Thursday, 11 June 2015 at 23:58:33 UTC, Cassio Butrico wrote:
What does the .json file and how to use it?
In D a file with the extension *.json is used to describe packets
that are included in your project, the dependency manager DUB.
For example, you can install Eclipse with DDT and
On Friday, 12 June 2015 at 00:35:35 UTC, Cassio Butrico wrote:
Thank you for answering me so fast , where do I get the DUB for
windows ?
http://code.dlang.org/download
What does the .json file and how to use it?
Thank you for answering me so fast , where do I get the DUB for
windows ?
On 06/11/2015 04:58 PM, Cassio Butrico wrote:
What does the .json file and how to use it?
There is also the .json file that is produced by dmd's -X command line
switch:
dmd -X foo.d
That outputs the members of the source code to foo.json in a way that
may be useful for a tool.
Ali
On Friday, 12 June 2015 at 00:56:45 UTC, Ali Çehreli wrote:
On 06/11/2015 04:58 PM, Cassio Butrico wrote:
What does the .json file and how to use it?
There is also the .json file that is produced by dmd's -X
command line switch:
dmd -X foo.d
That outputs the members of the source code
On Wednesday, 10 June 2015 at 22:03:52 UTC, Ali Çehreli wrote:
Another option:
void main()
{
auto a2 = new ubyte[5];
But this causes an extra zero-initialization of a2.
a2[] = 0xAA;// -- Assign to all elements
Is
auto a2 = value.repeat(size).array;
better in this regard?
On Wed, 10 Jun 2015 20:22:17 +
Adel Mamin via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
ubyte[5] a = 0xAA; // Fine. Five 0xAA bytes.
auto a2 = new ubyte[5]; // Fine. Five 0 bytes.
Now, let's say, I want to allocate an array of a size, derived at
run time, and
30 matches
Mail list logo