Re: auto ref function parameter causes that non copyable struct is copied?

2021-11-08 Thread tchaloupka via Digitalmars-d-learn
On Tuesday, 9 November 2021 at 02:43:55 UTC, jfondren wrote: On Tuesday, 9 November 2021 at 02:41:18 UTC, jfondren wrote: The expectation is probably that `f.move` set `f` to `Foo.init`, but the docs say: Posted too fast. Foo qualifies with its @disable: ```d struct A { int x; } struct B {

Re: auto ref function parameter causes that non copyable struct is copied?

2021-11-08 Thread jfondren via Digitalmars-d-learn
On Tuesday, 9 November 2021 at 02:41:18 UTC, jfondren wrote: The expectation is probably that `f.move` set `f` to `Foo.init`, but the docs say: Posted too fast. Foo qualifies with its @disable: ```d struct A { int x; } struct B { int x; @disable this(this); } unittest { import

Re: auto ref function parameter causes that non copyable struct is copied?

2021-11-08 Thread jfondren via Digitalmars-d-learn
On Tuesday, 9 November 2021 at 02:19:28 UTC, Stanislav Blinov wrote: On Monday, 8 November 2021 at 23:26:39 UTC, tchaloupka wrote: ``` auto gen() { Foo f; // <--- this one f.n = 42; return value(f.move()); } void main() { Foo f; f = gen().unwrap.move; }

Re: auto ref function parameter causes that non copyable struct is copied?

2021-11-08 Thread Stanislav Blinov via Digitalmars-d-learn
On Monday, 8 November 2021 at 23:26:39 UTC, tchaloupka wrote: ``` auto gen() { Foo f; // <--- this one f.n = 42; return value(f.move()); } void main() { Foo f; f = gen().unwrap.move; } ``` ~this(0) ~this(0) ~this(0) ~this(42) <- this is a copy (that

Re: dmd 2.098.0: version `GLIBC_2.14' not found (required by linux/bin64/dmd)

2021-11-08 Thread jfondren via Digitalmars-d-learn
On Monday, 8 November 2021 at 23:55:02 UTC, kdevel wrote: In previous versions I used the linux32/dmd with the -m64 switch in order to generate 64-bit code. But this does not work anymore: $ linux/bin32/dmd linux/bin32/dmd: /lib/libc.so.6: version `GLIBC_2.28' not found (required by

dmd 2.098.0: version `GLIBC_2.14' not found (required by linux/bin64/dmd)

2021-11-08 Thread kdevel via Digitalmars-d-learn
In previous versions I used the linux32/dmd with the -m64 switch in order to generate 64-bit code. But this does not work anymore: $ linux/bin32/dmd linux/bin32/dmd: /lib/libc.so.6: version `GLIBC_2.28' not found (required by linux/bin32/dmd) The reason for presence of these symbol

Re: Crosscompile to Windows

2021-11-08 Thread Luis via Digitalmars-d-learn
On Monday, 8 November 2021 at 01:16:25 UTC, rikki cattermole wrote: On 08/11/2021 11:34 AM, Imperatorn wrote: On Sunday, 7 November 2021 at 22:19:08 UTC, russhy wrote: If i remember correctly, all you have to do is:     dub build --arch=x86_64-pc-windows-msvc --compiler=ldc2 Is this

Re: Crosscompile to Windows

2021-11-08 Thread rikki cattermole via Digitalmars-d-learn
On 09/11/2021 12:44 PM, Luis wrote: It should work with the last version of DMD : https://dlang.org/changelog/2.098.0.html#target It won't. https://github.com/dlang/dub/blob/master/source/dub/compilers/dmd.d#L111

auto ref function parameter causes that non copyable struct is copied?

2021-11-08 Thread tchaloupka via Digitalmars-d-learn
Lets have this code: ```D import core.lifetime : forward; import core.stdc.stdio; import std.algorithm : move; struct Value(T) { private T storage; this()(auto ref T val) { storage = forward!val; } ref inout(T) get() inout { return storage; } } Value!T

Re: Completing C code with D style

2021-11-08 Thread forkit via Digitalmars-d-learn
On Monday, 8 November 2021 at 12:04:26 UTC, forkit wrote: case 'o' : result = result.filter!(a => (a % 2 == 1)).array; oops. case 'o' : result = result.filter!(a => (a % 2 != 0)).array;

Re: Does D have any number theory libraries?

2021-11-08 Thread Imperatorn via Digitalmars-d-learn
On Monday, 8 November 2021 at 20:09:26 UTC, Imperatorn wrote: On Monday, 8 November 2021 at 19:59:35 UTC, Enjoys Math wrote: In particular what I need are the fast implementations of: 1. The Nth prime number. 2. Prime Omega and/or Mobius function. 3. Works with some type of BigInt. 4.

Re: Does D have any number theory libraries?

2021-11-08 Thread Imperatorn via Digitalmars-d-learn
On Monday, 8 November 2021 at 19:59:35 UTC, Enjoys Math wrote: In particular what I need are the fast implementations of: 1. The Nth prime number. 2. Prime Omega and/or Mobius function. 3. Works with some type of BigInt. 4. Primorial. 5. Divisors of N. 6. Extended GCD algorithm. They don't

Does D have any number theory libraries?

2021-11-08 Thread Enjoys Math via Digitalmars-d-learn
In particular what I need are the fast implementations of: 1. The Nth prime number. 2. Prime Omega and/or Mobius function. 3. Works with some type of BigInt. 4. Primorial. 5. Divisors of N. 6. Extended GCD algorithm. They don't have to be the state-of-the art, but it would be nice if they

Re: Completing C code with D style

2021-11-08 Thread forkit via Digitalmars-d-learn
On Tuesday, 2 November 2021 at 23:45:39 UTC, pascal111 wrote: Next code originally was a classic C code I've written, it's pure vertical thinking, now, I converted it successfully to D code, but I think I made no much changes to make it has more horizontal thinking style that it seems D