Patterns for overload set recursion disambiguated by named arguments

2023-12-12 Thread monkyyy via Digitalmars-d-learn
raylib has a collection of well-organized but verbose functions https://www.raylib.com/cheatsheet/cheatsheet.html looking at draw colors are named `color` or if part of a gradient `color1` and `color2` `posx` and `centerx` are a bit more confusing but it should be fine etc. So I want to make

Re: Permutations of array (slice) ?

2023-12-12 Thread Kevin Bailey via Digitalmars-d-learn
On Tuesday, 12 December 2023 at 15:20:23 UTC, Paul Backus wrote: Because of autodecoding [1], slices of char and wchar are treated by Phobos as bidirectional ranges of dchar. (They are not random-access ranges because UTF-8 and UTF-16 are variable-length encodings.) To work around this, use

Re: Permutations of array (slice) ?

2023-12-12 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 12 December 2023 at 14:57:48 UTC, Kevin Bailey wrote: perm.d:8:26: error: none of the overloads of template ‘std.algorithm.iteration.permutations’ are callable using argument types ‘!()(char[])’ 8 | foreach (perm; as.permutations) | ^ /usr/

Permutations of array (slice) ?

2023-12-12 Thread Kevin Bailey via Digitalmars-d-learn
Could I get some help with a trivial question, I'm sure? How do pass a slice as a range? This code: import std.algorithm; // permutations import std.range; // replicate import std.stdio; // writeln int main() { char[] as = replicate(['a'], 5); as[0] = 'b'; foreach (perm; as.permutat

Re: Safer binary reading (or writing) code

2023-12-12 Thread Joel via Digitalmars-d-learn
On Tuesday, 12 December 2023 at 09:43:39 UTC, Joel wrote: I've got this mixin thing, I think it's less typo-prone. I haven't been able to make it show the variable's name, though. Also, it should be optional whether it prints anything, (it's not hard for me to do that though). ```d // mixin(j

Safer binary reading (or writing) code

2023-12-12 Thread Joel via Digitalmars-d-learn
I've got this mixin thing, I think it's less typo-prone. I haven't been able to make it show the variable's name, though. Also, it should be optional whether it prints anything, (it's not hard for me to do that though). ```d // mixin(jread("width")); -> fread(&width, 1, width.sizeof, bfile);

Re: openssl 1.1 vs. 3.0 for vibe.d:tls on Ubuntu 22.04

2023-12-12 Thread janrinok via Digitalmars-d-learn
On Friday, 28 July 2023 at 08:56:17 UTC, Guillaume Lathoud wrote: Hello, some context first: I recently updated a server to Ubuntu 22.04 which appears to have only openssl 3.0.2 installed. Dub could compile my project, but could not link it anymore, as the D code seemed to be expecting openss