Re: Need way to compare classes, and primitive types in bst Template

2017-06-08 Thread ag0aep6g via Digitalmars-d-learn
On 06/09/2017 05:32 AM, Mark wrote: https://dpaste.dzfl.pl/ff58876ce213 [...] What Id like to do is this: auto tree = new BSTbase!int; ... tree.insert(7); and auto Tree2 = new BSTbase!Aclass; ... Tree2.insert(Aclassobject); What I have is: Tree.insert(7, cast(real) 7); and Tree2.insert(Acla

Re: D for Web Development?

2017-06-08 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 8 June 2017 at 08:36:38 UTC, Nicholas Wilson wrote: Yes. Adam D. Ruppe also has some easy to use libraries that may suit your need. Indeed, my cgi.d, database.d, and postgres.d would give a foundation. https://github.com/adamdruppe/arsd you download the individual files and co

Need way to compare classes, and primitive types in bst Template

2017-06-08 Thread Mark via Digitalmars-d-learn
Ok. So I have a BST template, and it passes my tests. However, if you look at how I insert the data into the BST, you'll quickly notice the problem I have. https://dpaste.dzfl.pl/ff58876ce213 Keep in mind I just pasted that stack in there because I use it in my last unittest at the bottom.

Re: DList efficiency

2017-06-08 Thread Boris-Barboris via Digitalmars-d-learn
On Thursday, 8 June 2017 at 22:42:14 UTC, Boris-Barboris wrote: 1). Do I understand correctly, that there is currently no way (aside from editing the sources of course) to efficiently (using one underlying iteration) remove all\first element(s) from DList based on a predicate? Oh, sorry, I gu

DList efficiency

2017-06-08 Thread Boris-Barboris via Digitalmars-d-learn
Good day to you reader! I have a couple questions about Phobos: 1). Do I understand correctly, that there is currently no way (aside from editing the sources of course) to efficiently (using one underlying iteration) remove all\first element(s) from DList based on a predicate? Can such operatio

Re: Mutiple AliasSeq as input to template

2017-06-08 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 7 June 2017 at 19:03:39 UTC, David Sanders wrote: You can use nested templates to process multiple AliasSeqs like so: [snip] Interesting approach also.

Re: .sort vs sort(): std.algorithm not up to the task?

2017-06-08 Thread Timon Gehr via Digitalmars-d-learn
On 08.06.2017 14:06, Steven Schveighoffer wrote: The issue here is that arrays are special. Arrays allow foreach(i, v; arr) and foreach(v; arr). Ranges in general do not. So there is no way to forward this capability via the range interface. Not only that, but foreach(i, v; arr) is much diffe

Re: DMD [-O flag] vs. [memory allocation in a synchronized class]

2017-06-08 Thread Ivan Kazmenko via Digitalmars-d-learn
On Thursday, 8 June 2017 at 15:35:06 UTC, Ivan Kazmenko wrote: Perhaps a regression should be filed, or searched for, at issues.dlang.org. I can do it, but not right now, and would be glad if someone beats me to it. Reported: https://issues.dlang.org/show_bug.cgi?id=17481

Re: DMD [-O flag] vs. [memory allocation in a synchronized class]

2017-06-08 Thread Ivan Kazmenko via Digitalmars-d-learn
On Thursday, 8 June 2017 at 11:41:40 UTC, realhet wrote: I've managed to narrow the problem even more: //win32 dmd -O class Obj{ synchronized void trigger(){ new ubyte[1]; } } void main(){ auto k = new shared Obj; k.trigger; } This time I got a more sophisticated error message: object.

Re: D for Web Development?

2017-06-08 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-06-08 09:32, Michael Reiland wrote: A few questions: - Is vibe.d the recommended way of doing web work? Yes. - Is that book worth purchasing? Yes. - Does D have a good library for accessing Postgres? I see several listed but I don't know what the most stable would be for produc

Re: .sort vs sort(): std.algorithm not up to the task?

2017-06-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/7/17 9:57 PM, Andrew Edwards wrote: Ranges may be finite or infinite but, while the destination may be unreachable, we can definitely tell how far we've traveled. So why doesn't this work? import std.traits; import std.range; void main() { string[string] aa; // what others have re

Re: DMD [-O flag] vs. [memory allocation in a synchronized class]

2017-06-08 Thread realhet via Digitalmars-d-learn
I've managed to narrow the problem even more: //win32 dmd -O class Obj{ synchronized void trigger(){ new ubyte[1]; } } void main(){ auto k = new shared Obj; k.trigger; } This time I got a more sophisticated error message: object.Error@(0): Access Violation 0x7272456D in

Re: DMD [-O flag] vs. [memory allocation in a synchronized class]

2017-06-08 Thread ketmar via Digitalmars-d-learn
realhet wrote: On Thursday, 8 June 2017 at 10:48:41 UTC, ketmar wrote: worksforme with -O, and with -O -inline. I forgot to mention, that I'm generating win32 output. DMD32 D Compiler v2.074.0 mine: GNU/Linux, 32 bit, dmd git HEAD.

Re: DMD [-O flag] vs. [memory allocation in a synchronized class]

2017-06-08 Thread realhet via Digitalmars-d-learn
On Thursday, 8 June 2017 at 10:48:41 UTC, ketmar wrote: worksforme with -O, and with -O -inline. I forgot to mention, that I'm generating win32 output. DMD32 D Compiler v2.074.0

Re: DMD [-O flag] vs. [memory allocation in a synchronized class]

2017-06-08 Thread ketmar via Digitalmars-d-learn
worksforme with -O, and with -O -inline.

DMD [-O flag] vs. [memory allocation in a synchronized class]

2017-06-08 Thread realhet via Digitalmars-d-learn
Hi, This code works well with the unoptimized compilation with DMD. import std.array; synchronized class Obj{ private int[] arr; void trigger(){ arr.length += 1; } } void main(){ auto k = new shared Obj; k.trigger; } And when I use the -O option, it shows the following error in the t

Re: D for Web Development?

2017-06-08 Thread Nicholas Wilson via Digitalmars-d-learn
Welcome! On Thursday, 8 June 2017 at 07:32:44 UTC, Michael Reiland wrote: A few questions: - Is vibe.d the recommended way of doing web work? Yes. Adam D. Ruppe also has some easy to use libraries that may suit your need. - Is that book worth purchasing? Don't know. - Does D have a goo

Re: .sort vs sort(): std.algorithm not up to the task?

2017-06-08 Thread Russel Winder via Digitalmars-d-learn
On Thu, 2017-06-08 at 00:23 -0700, Jonathan M Davis via Digitalmars-d- learn wrote: > […] > > release is a member of SortedRange. You don't have to import it > separately. > You have it automatically by virtue of the fact that sort returns a > SortedRange. And unlike calling array, it doesn't copy

Re: D for Web Development?

2017-06-08 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 8 June 2017 at 07:32:44 UTC, Michael Reiland wrote: - Is vibe.d the recommended way of doing web work? Yes - Is that book worth purchasing? Yes - Does D have a good library for accessing Postgres? I see several listed but I don't know what the most stable would be for pro

Re: .sort vs sort(): std.algorithm not up to the task?

2017-06-08 Thread Andrew Edwards via Digitalmars-d-learn
On Thursday, 8 June 2017 at 07:23:27 UTC, Jonathan M Davis wrote: release is a member of SortedRange. You don't have to import it separately. You have it automatically by virtue of the fact that sort returns a SortedRange. And unlike calling array, it doesn't copy the entire range or allocate

Re: .sort vs sort(): std.algorithm not up to the task?

2017-06-08 Thread Russel Winder via Digitalmars-d-learn
On Wed, 2017-06-07 at 19:39 -0700, Jonathan M Davis via Digitalmars-d- learn wrote: > […] > Even better. I hadn't realized that such a function had been added. > Another import from Python. :-) -- Russel. = Dr Russel W

Re: The reason for SIGSEGV function pointer problem

2017-06-08 Thread Russel Winder via Digitalmars-d-learn
Thanks also to Paolo Invernizzi and ag0aep6g for answering with a similar response. Using Mike's response as it has extra detail. On Wed, 2017-06-07 at 20:00 +0200, Mike Wey via Digitalmars-d-learn wrote: > On 06/07/2017 06:50 PM, Russel Winder via Digitalmars-d-learn wrote: > > So why isn't &chec

Re: .sort vs sort(): std.algorithm not up to the task?

2017-06-08 Thread Timon Gehr via Digitalmars-d-learn
On 08.06.2017 03:57, Andrew Edwards wrote: Ranges may be finite or infinite but, while the destination may be unreachable, we can definitely tell how far we've traveled. So why doesn't this work? import std.traits; import std.range; void main() { string[string] aa; // what others h

Re: import statement placement

2017-06-08 Thread Russel Winder via Digitalmars-d-learn
On Wed, 2017-06-07 at 10:08 -0700, H. S. Teoh via Digitalmars-d-learn wrote: > On Wed, Jun 07, 2017 at 01:17:39PM +, Nicholas Wilson via > Digitalmars-d-learn wrote: > > On Wednesday, 7 June 2017 at 12:39:07 UTC, Russel Winder wrote: > > > Are there any idiom rules as to where to put import sta

D for Web Development?

2017-06-08 Thread Michael Reiland via Digitalmars-d-learn
Hey guys, I'm looking for a web solution that's: 1. Supported on Linux 2. Statically typed, 3. Reasonably performant, 4. Reasonably productive. 5. Simplicity (in terms of infrastructure and the language itself). The contenders as I see them are .Net Core, Go, and D. I know next to nothing a

Re: .sort vs sort(): std.algorithm not up to the task?

2017-06-08 Thread 9il via Digitalmars-d-learn
On Thursday, 8 June 2017 at 01:57:47 UTC, Andrew Edwards wrote: Ranges may be finite or infinite but, while the destination may be unreachable, we can definitely tell how far we've traveled. So why doesn't this work? import std.traits; import std.range; void main() { string[string] aa;

Re: .sort vs sort(): std.algorithm not up to the task?

2017-06-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, June 08, 2017 04:07:22 Andrew Edwards via Digitalmars-d-learn wrote: > On Thursday, 8 June 2017 at 03:40:08 UTC, Jonathan M Davis wrote: > > On Thursday, June 08, 2017 03:15:11 Andrew Edwards via > > > > Digitalmars-d-learn wrote: > >> I completely understand the differences between r