Re: Returning an empty range of a given type

2015-05-17 Thread Idan Arye via Digitalmars-d-learn
On Friday, 15 May 2015 at 03:47:46 UTC, rcorre wrote: On Friday, 15 May 2015 at 03:22:43 UTC, rcorre wrote: On Thursday, 14 May 2015 at 14:57:26 UTC, Idan Arye wrote: How about a more flexible solution? http://dpaste.dzfl.pl/2f99cc270651 Neat, thanks! The range I don't pick may be an exp

Re: better code organization?

2015-05-17 Thread Rikki Cattermole via Digitalmars-d-learn
On 17/05/2015 9:26 p.m., Suliman wrote: I am writing in D server and client apps. Server is base on vibed. Server and client have some common code (example working with config class). How I can prevent code duplication? I can move config code to separate module, but how to link on it? server cli

Re: ICE?

2015-05-17 Thread Daniel Kozak via Digitalmars-d-learn
On Sun, 17 May 2015 10:36:33 + Namespace via Digitalmars-d-learn wrote: > On Sunday, 17 May 2015 at 09:59:41 UTC, Daniel Kozak wrote: > > > > On Sun, 17 May 2015 09:33:27 + > > Namespace via Digitalmars-d-learn > > wrote: > > > >> On Sunday, 17 May 2015 at 09:30:16 UTC, Gary Willoughby

Re: ICE?

2015-05-17 Thread Namespace via Digitalmars-d-learn
On Sunday, 17 May 2015 at 09:59:41 UTC, Daniel Kozak wrote: On Sun, 17 May 2015 09:33:27 + Namespace via Digitalmars-d-learn wrote: On Sunday, 17 May 2015 at 09:30:16 UTC, Gary Willoughby wrote: > On Sunday, 17 May 2015 at 09:25:33 UTC, Namespace wrote: >> Is this error an ICE? I think

Re: ICE?

2015-05-17 Thread Daniel Kozak via Digitalmars-d-learn
On Sun, 17 May 2015 10:17:42 + anonymous via Digitalmars-d-learn wrote: > On Sunday, 17 May 2015 at 10:09:11 UTC, Daniel Kozak wrote: > > On Sunday, 17 May 2015 at 09:25:33 UTC, Namespace wrote: > [...] > >> Error: e2ir: cannot cast malloc(length * 8u) of type void* to > >> type char[] > >

ddbc: MySQL/MariaDB: Access Violation

2015-05-17 Thread Suliman via Digitalmars-d-learn
I am using this driver for access to MariaDB http://code.dlang.org/packages/ddbc The problem that it's work fine when it's used from desktop App, but when I try to run it's from vibed app i get "Access Violation". In my.ini I added string: bind-address = 127.0.0.1 Also I run next command:

Re: How to create a mutable array of strings?

2015-05-17 Thread Dennis Ritchie via Digitalmars-d-learn
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 :)

Re: ICE?

2015-05-17 Thread anonymous via Digitalmars-d-learn
On Sunday, 17 May 2015 at 10:09:11 UTC, Daniel Kozak wrote: On Sunday, 17 May 2015 at 09:25:33 UTC, Namespace wrote: [...] Error: e2ir: cannot cast malloc(length * 8u) of type void* to type char[] I would say this is not an ICE just normal error message. "e2ir: " shouldn't be there, though.

Re: ICE?

2015-05-17 Thread Daniel Kozak via Digitalmars-d-learn
On Sunday, 17 May 2015 at 09:59:41 UTC, Daniel Kozak wrote: On Sun, 17 May 2015 09:33:27 + Namespace via Digitalmars-d-learn wrote: On Sunday, 17 May 2015 at 09:30:16 UTC, Gary Willoughby wrote: > On Sunday, 17 May 2015 at 09:25:33 UTC, Namespace wrote: >> Is this error an ICE? I think

Re: How to create a mutable array of strings?

2015-05-17 Thread Daniel Kozak via Digitalmars-d-learn
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 wrote: I remembered code Ali Çereli. It really helped: http://forum.dlang.org/thread/ulhtlyxxclihaseef...@forum.dlang.org#post-mihl6m:241che:241:40digitalmar

Re: ICE?

2015-05-17 Thread Daniel Kozak via Digitalmars-d-learn
On Sunday, 17 May 2015 at 09:25:33 UTC, Namespace wrote: Is this error an ICE? I think so, because I see the internal filename, but I'm not sure. Error: e2ir: cannot cast malloc(length * 8u) of type void* to type char[] I would say this is not an ICE just normal error message.

Re: ICE?

2015-05-17 Thread Daniel Kozak via Digitalmars-d-learn
On Sun, 17 May 2015 09:33:27 + Namespace via Digitalmars-d-learn wrote: > On Sunday, 17 May 2015 at 09:30:16 UTC, Gary Willoughby wrote: > > On Sunday, 17 May 2015 at 09:25:33 UTC, Namespace wrote: > >> Is this error an ICE? I think so, because I see the internal > >> filename, but I'm not

Re: How to create a mutable array of strings?

2015-05-17 Thread Daniel Kozak via Digitalmars-d-learn
On Sun, 17 May 2015 09:39:21 + Dennis Ritchie via Digitalmars-d-learn 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 std.stdio, std.traits, std.range, s

Re: How to create a mutable array of strings?

2015-05-17 Thread Dennis Ritchie via Digitalmars-d-learn
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 :)

Re: How to create a mutable array of strings?

2015-05-17 Thread Dennis Ritchie via Digitalmars-d-learn
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; writeln("

Re: How to create a mutable array of strings?

2015-05-17 Thread Daniel Kozak via Digitalmars-d-learn
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

Re: How to create a mutable array of strings?

2015-05-17 Thread anonymous via Digitalmars-d-learn
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"); }

Re: How to create a mutable array of strings?

2015-05-17 Thread Dennis Ritchie via Digitalmars-d-learn
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 (isArray!(El

Re: ICE?

2015-05-17 Thread Gary Willoughby via Digitalmars-d-learn
On Sunday, 17 May 2015 at 09:25:33 UTC, Namespace wrote: Is this error an ICE? I think so, because I see the internal filename, but I'm not sure. Error: e2ir: cannot cast malloc(length * 8u) of type void* to type char[] Have you got a code sample to reproduce this?

Re: ICE?

2015-05-17 Thread Namespace via Digitalmars-d-learn
On Sunday, 17 May 2015 at 09:30:16 UTC, Gary Willoughby wrote: On Sunday, 17 May 2015 at 09:25:33 UTC, Namespace wrote: Is this error an ICE? I think so, because I see the internal filename, but I'm not sure. Error: e2ir: cannot cast malloc(length * 8u) of type void* to type char[] Have you

Re: How to create a mutable array of strings?

2015-05-17 Thread Dennis Ritchie via Digitalmars-d-learn
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 Koz

Re: How to create a mutable array of strings?

2015-05-17 Thread Daniel Kozak via Digitalmars-d-learn
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 wrote: Hi, It seems to me, or D do not create mutable array of strings? How to create a mutable

ICE?

2015-05-17 Thread Namespace via Digitalmars-d-learn
Is this error an ICE? I think so, because I see the internal filename, but I'm not sure. Error: e2ir: cannot cast malloc(length * 8u) of type void* to type char[]

better code organization?

2015-05-17 Thread Suliman via Digitalmars-d-learn
I am writing in D server and client apps. Server is base on vibed. Server and client have some common code (example working with config class). How I can prevent code duplication? I can move config code to separate module, but how to link on it? server client modules --?? it it's good? or the

Re: How to create a mutable array of strings?

2015-05-17 Thread via Digitalmars-d-learn
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 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", "b

Re: How to create a mutable array of strings?

2015-05-17 Thread Daniel Kozak via Digitalmars-d-learn
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 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", "b

Re: How to create a mutable array of strings?

2015-05-17 Thread Dennis Ritchie via Digitalmars-d-learn
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.

Re: How to create a mutable array of strings?

2015-05-17 Thread anonymous via Digitalmars-d-learn
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'

Re: How to create a mutable array of strings?

2015-05-17 Thread Jack Applegame via Digitalmars-d-learn
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';

Re: How to create a mutable array of strings?

2015-05-17 Thread Dennis Ritchie via Digitalmars-d-learn
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.

Re: How to create a mutable array of strings?

2015-05-17 Thread Daniel Kozak via Digitalmars-d-learn
On Sun, 17 May 2015 09:06:38 + Dennis Ritchie via Digitalmars-d-learn 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

Re: How to create a mutable array of strings?

2015-05-17 Thread Daniel Kozak via Digitalmars-d-learn
On Sun, 17 May 2015 09:06:38 + Dennis Ritchie via Digitalmars-d-learn 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

Re: How to create a mutable array of strings?

2015-05-17 Thread Dennis Ritchie via Digitalmars-d-learn
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: - c

How to create a mutable array of strings?

2015-05-17 Thread Dennis Ritchie via Digitalmars-d-learn
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]