Re: How add all folders of a diretory using -J ?

2020-04-02 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 1 April 2020 at 23:19:39 UTC, Baby Beaker wrote: Exemple: Inside folder Project I have ten folders. How can I add this ten folders using dmd and -J command? I don't want add one by one. you could use `-J .` (-J projectFolder) so in your imports you can use `import("subfolderna

Re: What does the [] operator do here?

2020-04-02 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 1 April 2020 at 19:35:30 UTC, Net wrote: from the below code, the expression "case [c]": void main() { import std.stdio, std.string, std.algorithm, std.conv; // Reduce the RPN expression using a stack readln.split.fold!((stack, op) { switch (op) {

Re: D on android and d_android

2020-04-02 Thread burt via Digitalmars-d-learn
On Thursday, 2 April 2020 at 01:53:30 UTC, Adam D. Ruppe wrote: On Wednesday, 1 April 2020 at 15:04:02 UTC, burt wrote: Well I'm European, so with 10.010 kB I mean 10010 kB = 10.010 MB in American/British. ah, of course. Well, I won't be able to finish it today anyway, so take your time. I

Re: D on android and d_android

2020-04-02 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 2 April 2020 at 11:29:24 UTC, burt wrote: Anyway, I don't think this fails to work because of an error in the d_android library. If you find anything else that may cause it, I am glad to know, but thank you for your help. Well, it is supposed to be a "just works" setup helper, so

Re: CT BitArray

2020-04-02 Thread Bastiaan Veelo via Digitalmars-d-learn
On Thursday, 1 November 2018 at 08:50:38 UTC, Bastiaan Veelo wrote: On Thursday, 1 November 2018 at 00:01:04 UTC, Stefan Koch wrote: On Wednesday, 31 October 2018 at 23:14:08 UTC, Bastiaan Veelo wrote: Currently, BitArray is not usable at compile time, so you cannot do ``` enum e = BitArray([1

Re: CT BitArray

2020-04-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/2/20 8:26 AM, Bastiaan Veelo wrote: On Thursday, 1 November 2018 at 08:50:38 UTC, Bastiaan Veelo wrote: On Thursday, 1 November 2018 at 00:01:04 UTC, Stefan Koch wrote: On Wednesday, 31 October 2018 at 23:14:08 UTC, Bastiaan Veelo wrote: Currently, BitArray is not usable at compile time,

Whats wrong with binery heap or i am not understand something?

2020-04-02 Thread AlexM via Digitalmars-d-learn
Please explain me whats wrong with binery heap?!!! Simple example: import std.container.binaryheap; import std.stdio; void main() { int[] a = [ 4, 1, 3, 2, 16, 9, 10, 14, 8, 7 ]; int[] b = new int[a.length]; auto h = BinaryHeap!(int[], "a > b")(b, 0); foreach (e; a) {

Re: Whats wrong with binery heap or i am not understand something?

2020-04-02 Thread Dennis via Digitalmars-d-learn
On Thursday, 2 April 2020 at 12:59:06 UTC, AlexM wrote: Please explain me whats wrong with binery heap?!!! This has nothing to do with binaryheap and all to do with writeln. writeln recognizes b and h as ranges, and prints them by iterating over each element, which advances the range to the en

Re: Whats wrong with binery heap or i am not understand something?

2020-04-02 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 2 April 2020 at 12:59:06 UTC, AlexM wrote: Please explain me whats wrong with binery heap?!!! Simple example: import std.container.binaryheap; import std.stdio; void main() { int[] a = [ 4, 1, 3, 2, 16, 9, 10, 14, 8, 7 ]; int[] b = new int[a.length]; auto h = BinaryHea

Re: Whats wrong with binery heap or i am not understand something?

2020-04-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/2/20 9:25 AM, WebFreak001 wrote: If BinaryHeap implemented a save() method it would be possible to do this without duplicating because writeln would call save to not modify the existing data. A binary heap has to move elements in order to iterate. So a save call would be equivalent to a

Re: Whats wrong with binery heap or i am not understand something?

2020-04-02 Thread Dennis via Digitalmars-d-learn
On Thursday, 2 April 2020 at 13:23:29 UTC, Dennis wrote: writeln recognizes b and h as ranges, and prints them by iterating over each element, Correction: this only applies to `h`, the array slice `b` will not be mutated by writeln.

Re: Whats wrong with binery heap or i am not understand something?

2020-04-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/2/20 8:59 AM, AlexM wrote: Please explain me whats wrong with binery heap?!!! Simple example: import std.container.binaryheap; import std.stdio; void main() {     int[] a = [ 4, 1, 3, 2, 16, 9, 10, 14, 8, 7 ];     int[] b = new int[a.length];     auto h = BinaryHeap!(int[], "a > b")(b,

Re: Whats wrong with binery heap or i am not understand something?

2020-04-02 Thread AlexM via Digitalmars-d-learn
On Thursday, 2 April 2020 at 12:59:06 UTC, AlexM wrote: Please explain me whats wrong with binery heap?!!! Simple example: import std.container.binaryheap; import std.stdio; void main() { int[] a = [ 4, 1, 3, 2, 16, 9, 10, 14, 8, 7 ]; int[] b = new int[a.length]; auto h = BinaryHea

Re: D on android and d_android

2020-04-02 Thread burt via Digitalmars-d-learn
On Thursday, 2 April 2020 at 12:13:27 UTC, Adam D. Ruppe wrote: On Thursday, 2 April 2020 at 11:29:24 UTC, burt wrote: Anyway, I don't think this fails to work because of an error in the d_android library. If you find anything else that may cause it, I am glad to know, but thank you for your he

Re: determine ldc version in static if or version?

2020-04-02 Thread Arine via Digitalmars-d-learn
On Thursday, 2 April 2020 at 01:35:42 UTC, Adam D. Ruppe wrote: On Thursday, 2 April 2020 at 01:27:26 UTC, Nicholas Wilson wrote: https://github.com/ldc-developers/druntime/blob/ldc/src/ldc/intrinsics.di#L22-L34 ah excellent that will do. thanks! Not sure if that is what you are looking for.

Structs containing mutually referential sumtypes

2020-04-02 Thread Ben Jones via Digitalmars-d-learn
I'm trying to define some structs that contain sumTypes (using the sumtype library) that refer to each other, but I get a recursive template instantiation error. It looks like typically recursion is handled in that library with the This type, but I don't see how that would apply here. Any adv

Static if a Function Exists

2020-04-02 Thread Jonathan Levi via Digitalmars-d-learn
I am trying to make a templated function for any arguments which will work for another. Like this: ``` class Cls { auto opBinary(string op, T)(T b) if (__traits(compiles, opBinaryImpl!op(this, b))) { return opBinaryImpl!op(this, b); } } auto opBinaryImpl(string op, T)(Cl