Re: Variadic function template with one inferred template argument

2020-11-07 Thread starcanopy via Digitalmars-d-learn
On Saturday, 7 November 2020 at 20:43:04 UTC, Ben Jones wrote: I'm trying to write a function template with 1 parameter whose type is inferred, but with the other parameters variadic. Basically, I want to do this: auto f(Ts..., Inferred)(Inferred inf){} and call it with f!(X,Y,Z)(w) //inferre

Re: How to rebind the default tkd GUI keybinds?

2020-10-17 Thread starcanopy via Digitalmars-d-learn
On Saturday, 17 October 2020 at 09:33:04 UTC, tastyminerals wrote: On Sunday, 11 October 2020 at 18:51:17 UTC, tastyminerals wrote: Tk default keys are somewhat different from what we used to use for selecting, copying and pasting the text. So, any Tk based GUI app starts with writing the rebin

Re: Win32api: How to send a Struct in DialogBox?

2020-10-13 Thread starcanopy via Digitalmars-d-learn
On Wednesday, 14 October 2020 at 00:07:10 UTC, Marcone wrote: Solved: Teste * params = cast(Teste*) lParam; writeln(params.nome); writeln(params.idade); But here, how can send struct? DialogBoxParam(null, MAKEINTRESOURCE(IDD_DIALOG1), null, &DlgMain, cast(int) &test); // Error, need "int" b

Re: Win32api: How to send a Struct in DialogBox?

2020-10-13 Thread starcanopy via Digitalmars-d-learn
On Tuesday, 13 October 2020 at 22:26:35 UTC, Marcone wrote: struct Teste { string nome = "Paul"; int idade = 33; } extern(Windows): BOOL DlgMain(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) nothrow { // I want to be able to use the struct object here. // writeln(test.

Phobos Unittesting

2020-10-12 Thread starcanopy via Digitalmars-d-learn
I'm working on adding support for Windows' symlinks in std.file. std.file.symlink's augmentation is straightforward, but testing it is not as easy. The reason is because, normally, one must confer escalated privileges to the executable making the link via CreateSymbolicLink[A|W]. This may be ob

Re: Why is BOM required to use unicode in tokens?

2020-09-15 Thread starcanopy via Digitalmars-d-learn
On Tuesday, 15 September 2020 at 21:27:25 UTC, Ola Fosheim Grøstad wrote: On Tuesday, 15 September 2020 at 01:49:13 UTC, James Blachly wrote: I wish to write a function including ∂x and ∂y (these are You can use the greek letter delta instead: δ Wouldn't that imply a normal differential?

Re: Initialize to None

2020-09-05 Thread starcanopy via Digitalmars-d-learn
On Sunday, 6 September 2020 at 03:42:36 UTC, N.S. wrote: I'd like to check whether a variable is initialized or not. And I'd also like to uninitialize a variable that is already initialized. Thanks! int x = void; if (x == void) { writeln("x not initialized"); } else { // OK, use x }

Re: D binary io functions

2020-08-29 Thread starcanopy via Digitalmars-d-learn
On Sunday, 30 August 2020 at 06:00:20 UTC, Andy Balba wrote: going nuts trying to figure out which D functions will read/write binary files For starters: https://dlang.org/phobos/std_stdio.html#.File.byChunk https://dlang.org/phobos/std_stdio.html#.File.rawRead https://dlang.org/phobos/std_stdi

Rounding Functions in Phobos

2020-08-02 Thread starcanopy via Digitalmars-d-learn
Is there a reason why ceil, floor, round, and friends return floats instead of an integer? There are l' variants for some of these, but I'd imagine template implementations of these operations would be better. Too much bloat? Naively, you'd have for ceil... // Return type would be numeric but