Re: length of string result not as expected

2013-08-14 Thread Jacob Carlborg
On 2013-08-14 05:05, Adam D. Ruppe wrote: Your code looks like D1... in D1 or D2: import std.uni; dstring s2 = toUTF32(str); writeln(s2.length); // 13 in D2 you can do it a little more efficiently like this: import std.range; writeln(walkLength(str)); // 13 In D1 you can easily implement

Linker error with one particular function

2013-08-14 Thread Gary Willoughby
I have defined the following module: /** * Module containing unit test helper functions for date time operations. */ module common.test.unit.datetime; /** * Imports. */ import std.conv; import std.datetime; /** * Return a unix timestamp. * * Params: * T = The return type of the

Re: Linker error with one particular function

2013-08-14 Thread Jacob Carlborg
On 2013-08-14 15:21, Gary Willoughby wrote: I have defined the following module: /** * Module containing unit test helper functions for date time operations. */ module common.test.unit.datetime; /** * Imports. */ import std.conv; import std.datetime; /** * Return a unix timestamp.

Re: Using zip to copy subarray into another

2013-08-14 Thread Craig Dillabaugh
On Tuesday, 13 August 2013 at 21:10:53 UTC, John Colvin wrote: On Tuesday, 13 August 2013 at 20:23:00 UTC, Craig Dillabaugh wrote: On Tuesday, 13 August 2013 at 19:50:37 UTC, Jonathan M Davis wrote: On Tuesday, August 13, 2013 21:22:24 Craig Dillabaugh wrote: I have code that attempts to copy

Re: Using zip to copy subarray into another

2013-08-14 Thread Craig Dillabaugh
On Tuesday, 13 August 2013 at 21:37:28 UTC, Joseph Rushton Wakeling wrote: clip. Try lockstep instead of zip. See: http://d.puremagic.com/issues/show_bug.cgi?id=8155#c8 ... for more info on the reasons why zip doesn't work here. While I've now solved my problem using a slightly different

Re: Linker error with one particular function

2013-08-14 Thread Gary Willoughby
On Wednesday, 14 August 2013 at 14:05:07 UTC, Jacob Carlborg wrote: Have you compiled all the files? Show us the command you use to compile your code. Usually this is enough rdmd main.d, where main.d is the file containing the main function. I'm sure all source files are compiled during the

Re: Linker error with one particular function

2013-08-14 Thread Dicebot
On Wednesday, 14 August 2013 at 16:11:38 UTC, Gary Willoughby wrote: ... Hm, I remember I had similar issue once which faded away once I have stopped naming main module as `main`. Was not able to track exact conditions to trigger it - this may be something similar.

Re: Is -1 7 ?

2013-08-14 Thread Andre Artus
On Sunday, 11 August 2013 at 17:01:46 UTC, Yota wrote: On Friday, 9 August 2013 at 17:35:18 UTC, monarch_dodra wrote: On Friday, 9 August 2013 at 15:28:10 UTC, Manfred Nowak wrote: michaelc37 wrote: WTF - -1 is greater than 7 From the docs: It is an error to have one operand be signed

Re: Is -1 7 ?

2013-08-14 Thread Ary Borenszweig
On 8/14/13 2:26 PM, Andre Artus wrote: On Sunday, 11 August 2013 at 17:01:46 UTC, Yota wrote: On Friday, 9 August 2013 at 17:35:18 UTC, monarch_dodra wrote: On Friday, 9 August 2013 at 15:28:10 UTC, Manfred Nowak wrote: michaelc37 wrote: WTF - -1 is greater than 7 From the docs: It

Re: Is -1 7 ?

2013-08-14 Thread luka8088
On 9.8.2013. 17:11, michaelc37 wrote: forgive me if i'm doing something stupid, i'm extremely tired and trying to avoid drinking coffee. void main() { int[] arr = [0, 1, 2, 3, 4, 5, 6]; //check 1 if (-1 arr.length) writefln(WTF - %d is greater than %d , -1, arr.length); else writefln(GOOD

Re: Is -1 7 ?

2013-08-14 Thread Andre Artus
On Wednesday, 14 August 2013 at 18:08:56 UTC, Ary Borenszweig wrote: On 8/14/13 2:26 PM, Andre Artus wrote: On Sunday, 11 August 2013 at 17:01:46 UTC, Yota wrote: On Friday, 9 August 2013 at 17:35:18 UTC, monarch_dodra wrote: On Friday, 9 August 2013 at 15:28:10 UTC, Manfred Nowak wrote:

Templated structs / variant values

2013-08-14 Thread Marek Janukowicz
I need to have a generalized settings functionality that should work like this: * I need to be able to add this to a class * each setting has its name, description, type and default value * I need to iterate over all settings for given object API would more or less look like: class A { ... here

strings and ranges

2013-08-14 Thread Jason den Dulk
Hello. When working with my code I noticed that if I use front on a char[], it yields a dchar. Am I correct in concluding that it does a UTF-8 to UTF-32 conversion and popFont will skip the whole character, not just a code unit? Also, does this mean that if I'm creating an output range for

Re: strings and ranges

2013-08-14 Thread anonymous
On Thursday, 15 August 2013 at 00:49:00 UTC, Jason den Dulk wrote: When working with my code I noticed that if I use front on a char[], it yields a dchar. Am I correct in concluding that it does a UTF-8 to UTF-32 conversion and popFont will skip the whole character, not just a code unit? yup

Re: Templated structs / variant values

2013-08-14 Thread JS
On Wednesday, 14 August 2013 at 22:28:13 UTC, Marek Janukowicz wrote: I need to have a generalized settings functionality that should work like this: * I need to be able to add this to a class * each setting has its name, description, type and default value * I need to iterate over all settings

double.init is real.nan, is it a bug?

2013-08-14 Thread bsd
Hi all, I think this is a bug, but if not I'm very confused and would like some clarification. When checking double values that could be nan or unassigned I have to check both double.init and double.nan. But double.init IS double.nan. --- void main() { // passes but I believe it is

Re: double.init is real.nan, is it a bug?

2013-08-14 Thread Jonathan M Davis
On Thursday, August 15, 2013 06:01:21 bsd wrote: Hi all, I think this is a bug, but if not I'm very confused and would like some clarification. When checking double values that could be nan or unassigned I have to check both double.init and double.nan. But double.init IS double.nan.

Re: double.init is real.nan, is it a bug?

2013-08-14 Thread JS
On Thursday, 15 August 2013 at 04:01:28 UTC, bsd wrote: Hi all, I think this is a bug, but if not I'm very confused and would like some clarification. When checking double values that could be nan or unassigned I have to check both double.init and double.nan. But double.init IS