How to sort a range

2016-03-08 Thread rcorre via Digitalmars-d-learn
I was in a situation where I wanted to remove duplicates from an OnlyResult. To do this with uniq, I needed to sort it. OnlyResult doesn't satisfy the template constraints of sort, but this seems easy enough to fix. I made front, back, and opIndex return by ref. With this, the following

Re: Is it safe to use 'is' to compare types?

2016-03-08 Thread Anon via Digitalmars-d-learn
On Tuesday, 8 March 2016 at 20:26:04 UTC, Yuxuan Shui wrote: On Monday, 7 March 2016 at 16:13:45 UTC, Steven Schveighoffer wrote: On 3/4/16 4:30 PM, Yuxuan Shui wrote: On Friday, 4 March 2016 at 15:18:55 UTC, Steven Schveighoffer wrote: [...] Thanks for answering. But I still don't

Re: Is it safe to use 'is' to compare types?

2016-03-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/8/16 3:26 PM, Yuxuan Shui wrote: On Monday, 7 March 2016 at 16:13:45 UTC, Steven Schveighoffer wrote: On 3/4/16 4:30 PM, Yuxuan Shui wrote: On Friday, 4 March 2016 at 15:18:55 UTC, Steven Schveighoffer wrote: [...] Thanks for answering. But I still don't understand why TypeInfo would

Re: Needed return type in static method? bug or feature?

2016-03-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, March 08, 2016 14:56:06 Antonio Corbi via Digitalmars-d-learn wrote: > On Tuesday, 8 March 2016 at 14:13:17 UTC, Adam D. Ruppe wrote: > > On Tuesday, 8 March 2016 at 13:40:06 UTC, Antonio Corbi wrote: > >> Is it a feature or a bug? > > > > It is allowed because the "auto" keyword

Re: Missing Symbol Accessing Templated Function Through Interface

2016-03-08 Thread crimaniak via Digitalmars-d-learn
On Tuesday, 8 March 2016 at 11:50:32 UTC, Peter wrote: Hi, Can anyone explain to me what's causing the following code to generate a missing symbol error... Relevant comment: https://issues.dlang.org/show_bug.cgi?id=8553#c1

Re: Missing Symbol Accessing Templated Function Through Interface

2016-03-08 Thread Nicholas Wilson via Digitalmars-d-learn
On Tuesday, 8 March 2016 at 11:50:32 UTC, Peter wrote: Hi, Can anyone explain to me what's causing the following code to generate a missing symbol error... import std.stdio; interface IProblem { void writeln(T...)(T arguments); } class Problem : IProblem { void writeln(T...)(T

Missing Symbol Accessing Templated Function Through Interface

2016-03-08 Thread Peter via Digitalmars-d-learn
Hi, Can anyone explain to me what's causing the following code to generate a missing symbol error... import std.stdio; interface IProblem { void writeln(T...)(T arguments); } class Problem : IProblem { void writeln(T...)(T arguments) { // This is just here to have code in an

Re: Memory Efficient HashSet

2016-03-08 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Tuesday, 8 March 2016 at 08:12:04 UTC, Nordlöw wrote: sparse_hash_set<> contained in https://github.com/sparsehash/sparsehash It appears to be very slow? What do you need it for?

Memory Efficient HashSet

2016-03-08 Thread Nordlöw via Digitalmars-d-learn
Has anybody put together a memory-efficient D-implementation of a HashSet Something like sparse_hash_set<> contained in https://github.com/sparsehash/sparsehash but in D.

Needed return type in static method? bug or feature?

2016-03-08 Thread Antonio Corbi via Digitalmars-d-learn
Hi all! The following code compiles and works, but the static methods do not have a return type. It also compiles and works if the appropiate (or auto) return type is added to them. -8>< import std.stdio; class B { int foo () { return 1; }

Re: Needed return type in static method? bug or feature?

2016-03-08 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 8 March 2016 at 13:40:06 UTC, Antonio Corbi wrote: Is it a feature or a bug? It is allowed because the "auto" keyword doesn't actually required for auto functions (or variables), what you need is any one of the storage classes. Those include static, auto, const, immutable, even

Re: Missing Symbol Accessing Templated Function Through Interface

2016-03-08 Thread Peter via Digitalmars-d-learn
On Tuesday, 8 March 2016 at 12:24:06 UTC, crimaniak wrote: On Tuesday, 8 March 2016 at 11:50:32 UTC, Peter wrote: Hi, Can anyone explain to me what's causing the following code to generate a missing symbol error... Relevant comment: https://issues.dlang.org/show_bug.cgi?id=8553#c1 Thanks

Re: Memory Efficient HashSet

2016-03-08 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Tuesday, 8 March 2016 at 08:12:04 UTC, Nordlöw wrote: Has anybody put together a memory-efficient D-implementation of a HashSet Something like sparse_hash_set<> contained in https://github.com/sparsehash/sparsehash but in D. There is an implementation in:

Re: Needed return type in static method? bug or feature?

2016-03-08 Thread Antonio Corbi via Digitalmars-d-learn
On Tuesday, 8 March 2016 at 14:13:17 UTC, Adam D. Ruppe wrote: On Tuesday, 8 March 2016 at 13:40:06 UTC, Antonio Corbi wrote: Is it a feature or a bug? It is allowed because the "auto" keyword doesn't actually required for auto functions (or variables), what you need is any one of the

Re: Speed up `dub`.

2016-03-08 Thread WebFreak001 via Digitalmars-d-learn
On Monday, 7 March 2016 at 21:49:59 UTC, xcvn wrote: Yes but if he wants to build then `--describe` will not help that much ! dub uses that internally for finding the files for compiling, so thats the cause of the slowdown

Trying to build a Scheme interpreter in D

2016-03-08 Thread John via Digitalmars-d-learn
Hi, I'm currently reading "Programming in D" and in order to get accustomed to D and it's syntax, I've decided to implement (actually port) a simple (and naive) Scheme interpreter from C to D. The original interpreter (in C) is described in a series of posts here:

Re: Is it safe to use 'is' to compare types?

2016-03-08 Thread Yuxuan Shui via Digitalmars-d-learn
On Monday, 7 March 2016 at 16:13:45 UTC, Steven Schveighoffer wrote: On 3/4/16 4:30 PM, Yuxuan Shui wrote: On Friday, 4 March 2016 at 15:18:55 UTC, Steven Schveighoffer wrote: [...] Thanks for answering. But I still don't understand why TypeInfo would need to be allocated. Aren't typeid()

Re: Speed up `dub`.

2016-03-08 Thread Luis via Digitalmars-d-learn
On Tuesday, 8 March 2016 at 15:43:28 UTC, rcorre wrote: On Monday, 7 March 2016 at 22:47:13 UTC, Luis wrote: I try to grab dstep with dub fetch step (dub version 0.9.24, built on Aug 19 2015, on Ubuntu), and try to run dub build step. I can confirm that on my machine takes around 5 seconds

D and devkitARM

2016-03-08 Thread TheGag96 via Digitalmars-d-learn
Hi guys, for a possibly-in-over-my-head project I'd like to get working a simple "Hello World" type program in which I call a D function from C in a 3DS homebrew app (or maybe even have it all in plain D with bindings to libctru). The thing is, I'm not skilled with Makefiles so I don't have a