Re: countUntil's constraints

2018-08-07 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 8 August 2018 at 01:33:26 UTC, Steven Schveighoffer wrote: On 8/7/18 9:20 PM, Nicholas Wilson wrote: the first overload is ptrdiff_t countUntil(alias pred = "a == b", R, Rs...)(R haystack, Rs needles) if (isForwardRange!R && Rs.length > 0 && isForwardRange!(Rs[0]) ==

Re: countUntil's constraints

2018-08-07 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 8 August 2018 at 01:33:26 UTC, Steven Schveighoffer wrote: On 8/7/18 9:20 PM, Nicholas Wilson wrote: the first overload is ptrdiff_t countUntil(alias pred = "a == b", R, Rs...)(R haystack, Rs needles) if (isForwardRange!R && Rs.length > 0 && isForwardRange!(Rs[0]) ==

Re: countUntil's constraints

2018-08-07 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/7/18 9:20 PM, Nicholas Wilson wrote: the first overload is ptrdiff_t countUntil(alias pred = "a == b", R, Rs...)(R haystack, Rs needles) if (isForwardRange!R && Rs.length > 0 && isForwardRange!(Rs[0]) == isInputRange!(Rs[0]) && is(typeof(startsWith!pred(haystack, needles[0]))) &&

countUntil's constraints

2018-08-07 Thread Nicholas Wilson via Digitalmars-d-learn
the first overload is ptrdiff_t countUntil(alias pred = "a == b", R, Rs...)(R haystack, Rs needles) if (isForwardRange!R && Rs.length > 0 && isForwardRange!(Rs[0]) == isInputRange!(Rs[0]) && is(typeof(startsWith!pred(haystack, needles[0]))) && (Rs.length == 1 ||

Re: Assignment in ternary condition operator

2018-08-07 Thread JN via Digitalmars-d-learn
On Tuesday, 7 August 2018 at 19:58:40 UTC, Steven Schveighoffer wrote: On 8/7/18 3:18 PM, JN wrote: [...] But operator precedence says that this is really: b = (a = (3 ? 4 : 5)) It's a different thing than the if statement. In the if statement, it's the *assignment* that is now the

Re: Assignment in ternary condition operator

2018-08-07 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/7/18 3:18 PM, JN wrote: int a, b; if (a = 3) { }   <- not allowed: Error: assignment cannot be used as a condition, perhaps == was meant? b = a = 3 ? 4 : 5   <- allowed I believe the second case should be disallowed also. It seems illogical, that the first one isn't allowed, but the

Assignment in ternary condition operator

2018-08-07 Thread JN via Digitalmars-d-learn
int a, b; if (a = 3) { } <- not allowed: Error: assignment cannot be used as a condition, perhaps == was meant? b = a = 3 ? 4 : 5 <- allowed I believe the second case should be disallowed also. It seems illogical, that the first one isn't allowed, but the second one is, when the

Re: dtoh

2018-08-07 Thread bauss via Digitalmars-d-learn
On Tuesday, 7 August 2018 at 12:46:31 UTC, Steven Schveighoffer wrote: On 8/7/18 6:08 AM, bauss wrote: On Monday, 6 August 2018 at 13:28:05 UTC, Laeeth Isharc wrote: Hi Walter. Can dtoh be open-sourced now that dmd is? https://github.com/adamdruppe/dtoh I might be confused, but it seems

Re: dtoh

2018-08-07 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/7/18 6:08 AM, bauss wrote: On Monday, 6 August 2018 at 13:28:05 UTC, Laeeth Isharc wrote: Hi Walter. Can dtoh be open-sourced now that dmd is? https://github.com/adamdruppe/dtoh I might be confused, but it seems like it is there. I think he meant htod: https://dlang.org/htod.html

Could you anybody using DerelictSDL2 on Android?

2018-08-07 Thread zhani via Digitalmars-d-learn
howdy :-) can anybody use sdl2 on android? first, i got a ldc2 for android. i just followed here on windows: https://wiki.dlang.org/Build_D_for_Android#Windows so i could compile a sieve.d but didnt run it on android yet. then next? wut can i try for using DerelictSDL2 on android? and this

Re: dtoh

2018-08-07 Thread bauss via Digitalmars-d-learn
On Monday, 6 August 2018 at 13:28:05 UTC, Laeeth Isharc wrote: Hi Walter. Can dtoh be open-sourced now that dmd is? Laeeth. https://github.com/adamdruppe/dtoh I might be confused, but it seems like it is there.

Re: GC and void[N] in struct

2018-08-07 Thread Simen Kjærås via Digitalmars-d-learn
On Monday, 6 August 2018 at 19:43:17 UTC, Steven Schveighoffer wrote: On 8/6/18 2:59 PM, vit wrote: struct ExprImpl(Ts...){     enum N = max(staticMap!(sizeOf, Ts)); This is clever! No need to be clever though - we've got std.traits.Largest for exactly this kind of purpose. -- Simen