Re: Memory allocation failed in CT

2019-07-09 Thread Max Haughton via Digitalmars-d-learn
Is this a 64 or 32 bit compiler? Also could you post the source code if possible? You could try "--DRT-gcopt=profile:1" druntime flag to see if the compiler is running out of memory for real

Re: Memory allocation failed in CT

2019-07-09 Thread Andrey via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 17:59:24 UTC, Max Haughton wrote: On Tuesday, 9 July 2019 at 17:48:52 UTC, Andrey wrote: Hello, I have got a problem with compile-time calulations. I have some code generator that should create some long string of code during CT and after generation I mixin it. If I

Re: Memory allocation failed in CT

2019-07-09 Thread Andrey via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 17:59:24 UTC, Max Haughton wrote: On Tuesday, 9 July 2019 at 17:48:52 UTC, Andrey wrote: I in addition wrote "buffer.reserve(10 * 1014 * 1024);" and it also doesn't help.

Re: Memory allocation failed in CT

2019-07-09 Thread Max Haughton via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 17:48:52 UTC, Andrey wrote: Hello, I have got a problem with compile-time calulations. I have some code generator that should create some long string of code during CT and after generation I mixin it. If I run it normally - in run time - then there is no error and I

Memory allocation failed in CT

2019-07-09 Thread Andrey via Digitalmars-d-learn
Hello, I have got a problem with compile-time calulations. I have some code generator that should create some long string of code during CT and after generation I mixin it. If I run it normally - in run time - then there is no error and I get expected output - string with size ~ 3.5 MB. If I

Re: Is there something like a consuming take?

2019-07-09 Thread berni via Digitalmars-d-learn
Hurray, it works! :-) https://run.dlang.io/is/2GMq34 I have to use classes to avoid copying when arguments are passed to a function. (And yes, there should of course be much more checks, especially when there are to few elements in the original range. And it could be speed improved and so

Re: Using output-range overloads of SysTime.toISO{Ext}String with formatting code

2019-07-09 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 08:51:59 UTC, Mitacha wrote: I've managed to make it work using 'alias this' and wrapper struct. https://run.dlang.io/is/3SMEFZ It's not an elegant solution, there could be a better way to do this. Yea, a wrapper struct with custom `toString` seems the most

Re: Using output-range overloads of SysTime.toISO{Ext}String with formatting code

2019-07-09 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On Monday, 8 July 2019 at 12:53:18 UTC, Digital Mars wrote: I guess that there is no way to have `writeln` automatically use the output range overload instead of allocating one. You need somehow to provide the output range to `toISOExtString` explicitly because `writeln` outputs the return of

Re: SendMessageTimeoutW requires casting string to uint?

2019-07-09 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 13:10:57 UTC, a11e99z wrote: On Tuesday, 9 July 2019 at 12:14:38 UTC, BoQsc wrote: On Tuesday, 9 July 2019 at 11:11:53 UTC, Dejan Lekic wrote: auto result = SendMessageTimeoutW( HWND_BROADCAST, WM_SETTINGCHANGE, 0, envi.toUTF16z,

LDC won't find ld linker -why?

2019-07-09 Thread Dukc via Digitalmars-d-learn
I just downloaded ldc 1.15.0 for Linux from GH releases. Testing it, it will make the object file out of a hello world application, but then complain: ``` collect2: fatal error: cannot find ‘ld’ compilation terminated. ``` This is strange, because running either `ld` or `clang` (yes, I

Re: LDC won't find ld linker -why?

2019-07-09 Thread Dukc via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 15:25:17 UTC, Dukc wrote: (ln is in `usr/bin/` meant that `ld` is there

Re: Is there something like a consuming take?

2019-07-09 Thread berni via Digitalmars-d-learn
On Sunday, 7 July 2019 at 21:55:17 UTC, Jonathan M Davis wrote: Having one range know about the other isn't enough. That just means that the take range would tell the other range that it had popped an element off, and then the other would know that it had to pop an element off. That still

Re: Why does `static foreach` lead to something calling `~=` internally?

2019-07-09 Thread Exil via Digitalmars-d-learn
On Sunday, 7 July 2019 at 18:45:14 UTC, 0xEAB wrote: On Sunday, 7 July 2019 at 16:51:57 UTC, 0xEAB wrote: Why does this `static foreach` lead to hidden usage of operator Further notes by Dan (aka "Wild"): I added some small printfs to the compiler, http://ix.io/1NWM It seems like it lowers

Re: SendMessageTimeoutW requires casting string to uint?

2019-07-09 Thread a11e99z via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 12:14:38 UTC, BoQsc wrote: On Tuesday, 9 July 2019 at 11:11:53 UTC, Dejan Lekic wrote: auto result = SendMessageTimeoutW( HWND_BROADCAST, WM_SETTINGCHANGE, 0, envi.toUTF16z, SMTO_ABORTIFHUNG, timeout, null

Re: SendMessageTimeoutW requires casting string to uint?

2019-07-09 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 11:11:53 UTC, Dejan Lekic wrote: Now that I browsed the std.utf more, I realised what fits your need best is the https://dlang.org/phobos/std_utf.html#toUTF16z So far, this is what I have: Filename: myVersion.d import core.sys.windows.windows :

Blog Post #0051: MVC IV - ComboBox with Text

2019-07-09 Thread Ron Tarrant via Digitalmars-d-learn
Today's post starts a mini series-within-a-series on dressing up the ComboBox using a ListStore. Essentially, it's ListStore basics leading up to how this type of model is used with a TreeView. You can find it here: https://gtkdcoding.com/2019/07/09/0051-mvc-iv-combobox-text.html

Re: SendMessageTimeoutW requires casting string to uint?

2019-07-09 Thread Dejan Lekic via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 10:34:54 UTC, BoQsc wrote: All I know that there was toString16z function from tango project, that made it all work. Now that I browsed the std.utf more, I realised what fits your need best is the https://dlang.org/phobos/std_utf.html#toUTF16z

Re: SendMessageTimeoutW requires casting string to uint?

2019-07-09 Thread Dejan Lekic via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 10:34:54 UTC, BoQsc wrote: I'm quite new to the programming, and I'm getting unsure how to make SendMessageTimeoutW to work with D lang. Most of my attention right now resides around the Argument of the SendMessageTimeoutW function: "Environment", It seems that

Re: SendMessageTimeoutW requires casting string to uint?

2019-07-09 Thread Dejan Lekic via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 11:06:54 UTC, Dejan Lekic wrote: std.utf module has all encoding/decoding you need (in this case UTF-16). I guess You need to convert your string using toUTF16 ( https://dlang.org/phobos/std_utf.html#toUTF16 ). I do not do Windows programming so I am not 100% sure

SendMessageTimeoutW requires casting string to uint?

2019-07-09 Thread BoQsc via Digitalmars-d-learn
I'm quite new to the programming, and I'm getting unsure how to make SendMessageTimeoutW to work with D lang. Most of my attention right now resides around the Argument of the SendMessageTimeoutW function: "Environment", It seems that SendMessageTimeoutW accepts only uint type, and string

Re: Trying to alias this a grapheme range + making it a forward range

2019-07-09 Thread aliak via Digitalmars-d-learn
On Monday, 8 July 2019 at 23:01:49 UTC, ag0aep6g wrote: On 08.07.19 23:55, aliak wrote: [...] `source.front` is a temporary `Grapheme` and you're calling `opSlice` on it. The documentation for `Grapheme.opSlice` warns: "Invalidates when this Grapheme leaves the scope, attempts to use it

Using output-range overloads of SysTime.toISO{Ext}String with formatting code

2019-07-09 Thread Mitacha via Digitalmars-d-learn
On Monday, 8 July 2019 at 12:53:18 UTC, Digital Mars wrote: 08.07.2019 13:38, Joseph Rushton Wakeling пишет: [...] Sorry that my answer wasn't thoughtful. I guess that there is no way to have `writeln` automatically use the output range overload instead of allocating one. You need somehow