Re: mir: How to change iterator?

2020-04-18 Thread 9il via Digitalmars-d-learn
On Sunday, 19 April 2020 at 02:56:30 UTC, 9il wrote: On Friday, 17 April 2020 at 08:40:36 UTC, WebFreak001 wrote: On Tuesday, 14 April 2020 at 20:24:05 UTC, jmh530 wrote: [...] Use std.algorithm:equal for range compare with approxEqual for your comparator: assert(equal!approxEqual(y,

Re: mir: How to change iterator?

2020-04-18 Thread 9il via Digitalmars-d-learn
On Friday, 17 April 2020 at 08:40:36 UTC, WebFreak001 wrote: On Tuesday, 14 April 2020 at 20:24:05 UTC, jmh530 wrote: [...] Use std.algorithm:equal for range compare with approxEqual for your comparator: assert(equal!approxEqual(y, [2.5, 2.5].sliced(2))); or mir.algorithm.iteration: each

Re: Checked!({short, ushort, byte, ubyte}, Throw): compilation fails

2020-04-18 Thread tsbockman via Digitalmars-d-learn
On Saturday, 18 April 2020 at 15:20:42 UTC, kdevel wrote: On Saturday, 18 April 2020 at 08:39:52 UTC, tsbockman wrote: https://code.dlang.org/packages/checkedint Hm. $ dub test Generating test runner configuration 'checkedint-test-library' for 'library' (library). Excluding package.d

Re: Checked!({short, ushort, byte, ubyte}, Throw): compilation fails

2020-04-18 Thread tsbockman via Digitalmars-d-learn
On Saturday, 18 April 2020 at 15:20:42 UTC, kdevel wrote: On Saturday, 18 April 2020 at 08:39:52 UTC, tsbockman wrote: https://code.dlang.org/packages/checkedint Hm. $ dub test Generating test runner configuration 'checkedint-test-library' for 'library' (library). Excluding package.d

Re: How convert String to Hex?

2020-04-18 Thread Simen Kjærås via Digitalmars-d-learn
On Saturday, 18 April 2020 at 15:47:38 UTC, Marcone wrote: How convert String to Hex? Example: string text = "Hello World"; // Converted to Hex = 48656c6c6f20576f726c64 import std.format : format; string hex = format("%(%2x%)", "Hello World"); import std.stdio : writeln;

How convert String to Hex?

2020-04-18 Thread Marcone via Digitalmars-d-learn
How convert String to Hex? Example: string text = "Hello World"; // Converted to Hex = 48656c6c6f20576f726c64

Re: Checked!({short, ushort, byte, ubyte}, Throw): compilation fails

2020-04-18 Thread kdevel via Digitalmars-d-learn
On Saturday, 18 April 2020 at 08:39:52 UTC, tsbockman wrote: [...] You also get a deprecation message, about an integral promotion not being performed. I believe the result is correct and the warning can be ignored. So the warning is a bug? The deprecation message is a consequence of a

Re: Extracting user defined attributes on function parameters

2020-04-18 Thread Simen Kjærås via Digitalmars-d-learn
On Saturday, 18 April 2020 at 09:19:48 UTC, Simen Kjærås wrote: On Wednesday, Friday, 17 Apr 2020 17:45:47 UTC, H. S. Teoh wrote: I wonder if the ultimate cause of the above case is ultimately caused by the change to import semantics that hid private symbols from outside the module. Perhaps

Re: Extracting user defined attributes on function parameters

2020-04-18 Thread Simen Kjærås via Digitalmars-d-learn
On Wednesday, Friday, 17 Apr 2020 17:45:47 UTC, H. S. Teoh wrote: I wonder if the ultimate cause of the above case is ultimately caused by the change to import semantics that hid private symbols from outside the module. Perhaps something, somewhere, is triggering an illegal access of a

Re: Checked!({short, ushort, byte, ubyte}, Throw): compilation fails

2020-04-18 Thread tsbockman via Digitalmars-d-learn
On Friday, 17 April 2020 at 21:25:34 UTC, kdevel wrote: A curiosity. Usually you cast into the type on the left. But Checked!(short, Throw) b = cast (Checked!(short, Throw)) a; does not compile: Error: template std.experimental.checkedint.Checked!(int, Throw).Checked.opCast cannot

Re: Checked!({short, ushort, byte, ubyte}, Throw): compilation fails

2020-04-18 Thread tsbockman via Digitalmars-d-learn
On Friday, 17 April 2020 at 21:25:34 UTC, kdevel wrote: On Friday, 17 April 2020 at 12:59:20 UTC, Simen Kjærås wrote: A curiosity. Usually you cast into the type on the left. But Checked!(short, Throw) b = cast (Checked!(short, Throw)) a; does not compile: Error: template

Re: Working with cmd

2020-04-18 Thread user1234 via Digitalmars-d-learn
On Friday, 17 April 2020 at 21:38:23 UTC, Quantium wrote: Are there any libs which can be used to access cmd commands? You can pipe cmd.exe: --- import std.process : pipeProcess, ProcessPipes; ProcessPipes pp = pipeProcess(["cmd.exe"]); pp.stdin.writeln("echo foobar"); pp.stdin.close;

Re: Working with cmd

2020-04-18 Thread novice2 via Digitalmars-d-learn
On Friday, 17 April 2020 at 21:38:23 UTC, Quantium wrote: Are there any libs which can be used to access cmd commands? std.process https://dlang.org/phobos/std_process.html#.execute