On Monday, 18 May 2015 at 13:14:38 UTC, Steven Schveighoffer
wrote:
It's annoying to have to dup each one.
Yes, it's really annoying. However, the problem can be solved as
follows:
On 5/18/15 9:55 AM, Dennis Ritchie wrote:
On Monday, 18 May 2015 at 13:14:38 UTC, Steven Schveighoffer wrote:
It's annoying to have to dup each one.
Yes, it's really annoying. However, the problem can be solved as follows:
On Monday, 18 May 2015 at 14:43:33 UTC, Steven Schveighoffer
wrote:
Right, you'd apply the map/array combo to each element:
Yes, I knew it.
alias m = map!(a = a.dup); // too bad can't do array as well
auto s = [m([foo, baz]).array, m([bar, test]).array];
Or to get even more crazy:
auto s
On 5/17/15 5:15 AM, Dennis Ritchie wrote:
This option is also a strange:
char[][] s = [foo.dup, bar.dup];
s[1][1] = 't';
In my opinion, you need to add to D keyword mutable.
It's annoying to have to dup each one.
But, you do have a couple other possibilities:
auto s = [foo.dup, bar.dup];
On Sunday, 17 May 2015 at 09:06:40 UTC, Dennis Ritchie wrote:
Hi,
It seems to me, or D do not create mutable array of strings?
How to create a mutable equivalent of a string array?
-
string[] s = [foo, bar];
// s[1][1] = 't'; // immutable expression s[1][1]
It's uncomfortable:
-
char
Hi,
It seems to me, or D do not create mutable array of strings?
How to create a mutable equivalent of a string array?
-
string[] s = [foo, bar];
// s[1][1] = 't'; // immutable expression s[1][1]
On Sun, 17 May 2015 09:06:38 +
Dennis Ritchie via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
Hi,
It seems to me, or D do not create mutable array of strings?
How to create a mutable equivalent of a string array?
-
string[] s = [foo, bar];
// s[1][1] = 't
On Sun, 17 May 2015 09:06:38 +
Dennis Ritchie via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
Hi,
It seems to me, or D do not create mutable array of strings?
How to create a mutable equivalent of a string array?
-
string[] s = [foo, bar];
// s[1][1] = 't
This option is also a strange:
char[][] s = [foo.dup, bar.dup];
s[1][1] = 't';
In my opinion, you need to add to D keyword mutable.
On Sunday, 17 May 2015 at 09:10:06 UTC, Dennis Ritchie wrote:
It's uncomfortable:
-
char[][] s = [['f', 'o', 'o'], ['b', 'a', 'r']];
s[1][1] = 't';
auto s = [foo.dup, bar.dup];
s[1][1] = 't';
On Sunday, 17 May 2015 at 09:18:15 UTC, Daniel Kozak wrote:
auto s = cast(char[][])[foo, bar];
Thanks. This version I was completely satisfied.
On Sunday, 17 May 2015 at 09:20:17 UTC, Dennis Ritchie wrote:
On Sunday, 17 May 2015 at 09:18:15 UTC, Daniel Kozak wrote:
auto s = cast(char[][])[foo, bar];
Thanks. This version I was completely satisfied.
Remember that Daniel Kozak wrote if you are sure thats what you
really need. I'm
On Sunday, 17 May 2015 at 09:18:15 UTC, Daniel Kozak wrote:
On Sun, 17 May 2015 09:06:38 +
Dennis Ritchie via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com
wrote:
Hi,
It seems to me, or D do not create mutable array of strings?
How to create a mutable equivalent of a string
On Sunday, 17 May 2015 at 09:18:15 UTC, Daniel Kozak wrote:
On Sun, 17 May 2015 09:06:38 +
Dennis Ritchie via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com
wrote:
Hi,
It seems to me, or D do not create mutable array of strings?
How to create a mutable equivalent of a string
On Sunday, 17 May 2015 at 09:21:58 UTC, Marc Schütz wrote:
On Sunday, 17 May 2015 at 09:18:15 UTC, Daniel Kozak wrote:
On Sun, 17 May 2015 09:06:38 +
Dennis Ritchie via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com
wrote:
Hi,
It seems to me, or D do not create mutable array
On Sunday, 17 May 2015 at 09:24:19 UTC, anonymous wrote:
On Sunday, 17 May 2015 at 09:20:17 UTC, Dennis Ritchie wrote:
On Sunday, 17 May 2015 at 09:18:15 UTC, Daniel Kozak wrote:
auto s = cast(char[][])[foo, bar];
Thanks. This version I was completely satisfied.
Remember that Daniel Kozak
On Sunday, 17 May 2015 at 09:20:17 UTC, Dennis Ritchie wrote:
On Sunday, 17 May 2015 at 09:18:15 UTC, Daniel Kozak wrote:
auto s = cast(char[][])[foo, bar];
Thanks. This version I was completely satisfied.
So maybe this one would be ok with you too :)
auto s = to!(char[][])([foo, bar]);
I remembered code Ali Çereli. It really helped:
http://forum.dlang.org/thread/ulhtlyxxclihaseef...@forum.dlang.org#post-mihl6m:241che:241:40digitalmars.com
-
import std.stdio, std.traits, std.range, std.algorithm;
auto deepDup(A)(A arr)
if (isArray!A)
{
static if
On Sunday, 17 May 2015 at 09:26:15 UTC, Dennis Ritchie wrote:
And no crashes on Windows :)
Yeah, on windows it's even worse.
void main()
{
auto s = cast(char[][])[foo, bar];
s[1][1] = 't';
import std.stdio;
writeln(bar);
}
On Sun, 17 May 2015 09:39:21 +
Dennis Ritchie via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
I remembered code Ali Çereli. It really helped:
http://forum.dlang.org/thread/ulhtlyxxclihaseef...@forum.dlang.org#post-mihl6m:241che:241:40digitalmars.com
-
import
On Sunday, 17 May 2015 at 09:36:33 UTC, anonymous wrote:
On Sunday, 17 May 2015 at 09:26:15 UTC, Dennis Ritchie wrote:
And no crashes on Windows :)
Yeah, on windows it's even worse.
void main()
{
auto s = cast(char[][])[foo, bar];
s[1][1] = 't';
import std.stdio;
On Sunday, 17 May 2015 at 09:37:56 UTC, Daniel Kozak wrote:
So maybe this one would be ok with you too :)
auto s = to!(char[][])([foo, bar]);
Now it works :)
On Sunday, 17 May 2015 at 09:57:05 UTC, Daniel Kozak wrote:
On Sun, 17 May 2015 09:39:21 +
Dennis Ritchie via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com
wrote:
I remembered code Ali Çereli. It really helped:
On Sunday, 17 May 2015 at 10:05:34 UTC, Daniel Kozak wrote:
Ouch ignore this one :D
Yes, it will not work with multidimensional arrays :)
24 matches
Mail list logo