Re: Garbage Collector : Ignoring a reference

2016-04-30 Thread Namespace via Digitalmars-d-learn
On Tuesday, 26 April 2016 at 09:07:59 UTC, Begah wrote: I am trying to create an asset manager for my textures. I had the idea ( it may be a wrong idea ) to create a hashmap of my textures with a string as the key. When the program request a texture, it firts check if it is in the hashmap and t

Linking to library dependent on Objective-C functions

2016-04-30 Thread FreeSlave via Digitalmars-d-learn
I have two files. The one has Objective-C functions and interfaces declarations written in D. Another file is main app and it imports the first and uses its functions. Imported file: http://codepad.org/jqdBb6sh Main file: http://codepad.org/0gKBqKxi When I compile them in one command it run wi

Re: Garbage Collector : Ignoring a reference

2016-04-30 Thread Guillaume Piolat via Digitalmars-d-learn
On Tuesday, 26 April 2016 at 09:07:59 UTC, Begah wrote: I am trying to create an asset manager for my textures. I had the idea ( it may be a wrong idea ) to create a hashmap of my textures with a string as the key. When the program request a texture, it firts check if it is in the hashmap and t

Can't use std.algorithm.remove on a char[]?

2016-04-30 Thread TheGag96 via Digitalmars-d-learn
I was just writing some code trying to remove a value from a character array, but the compiler complained "No overload matches for remove", and if I specifically say use std.algorithm.remove() the compiler doesn't think it fits any definition. For reference, this would be all I'm doing: char[

Re: Can't use std.algorithm.remove on a char[]?

2016-04-30 Thread ag0aep6g via Digitalmars-d-learn
On 30.04.2016 18:44, TheGag96 wrote: I was just writing some code trying to remove a value from a character array, but the compiler complained "No overload matches for remove", and if I specifically say use std.algorithm.remove() the compiler doesn't think it fits any definition. For reference, t

Re: Can't use std.algorithm.remove on a char[]?

2016-04-30 Thread Jon D via Digitalmars-d-learn
On Saturday, 30 April 2016 at 18:32:32 UTC, ag0aep6g wrote: On 30.04.2016 18:44, TheGag96 wrote: I was just writing some code trying to remove a value from a character array, but the compiler complained "No overload matches for remove", and if I specifically say use std.algorithm.remove() the c

Re: Can't use std.algorithm.remove on a char[]?

2016-04-30 Thread ag0aep6g via Digitalmars-d-learn
On 30.04.2016 21:08, Jon D wrote: If an initial step is to fix the documentation, it would be helpful to include specifically that it doesn't work with characters. It's not obvious that characters don't meet the requirement. Characters are not the problem. remove works fine on a range of chars,

Re: Can't use std.algorithm.remove on a char[]?

2016-04-30 Thread Jon D via Digitalmars-d-learn
On Saturday, 30 April 2016 at 19:21:30 UTC, ag0aep6g wrote: On 30.04.2016 21:08, Jon D wrote: If an initial step is to fix the documentation, it would be helpful to include specifically that it doesn't work with characters. It's not obvious that characters don't meet the requirement. Charact

Re: Can't use std.algorithm.remove on a char[]?

2016-04-30 Thread ag0aep6g via Digitalmars-d-learn
On 30.04.2016 21:41, Jon D wrote: I didn't mean to suggest making the documentation technically incorrect. Just that it be helpful in important cases that won't necessarily be obvious. To me, char[] is an important case, one that's not made obvious by listing the hasLvalueElements constraint by i

Re: VariantPointer

2016-04-30 Thread Nordlöw via Digitalmars-d-learn
On Wednesday, 20 April 2016 at 13:41:27 UTC, Nordlöw wrote: https://github.com/nordlow/phobos-next/blob/master/src/variant_pointer.d Moved here: https://github.com/nordlow/phobos-next/blob/master/src/variant_ex.d

Rust piece on integer safety

2016-04-30 Thread Laeeth Isharc via Digitalmars-d-learn
All the design/discussion/implementation of this scheme for handling integer overflow would be wasted if it didn’t actually find any bugs in practice. I personally have had quite a few bugs found nearly as I write them, with expressions like cmp::max(x - y, z) (they never hit the internet, so n

Re: Rust piece on integer safety

2016-04-30 Thread Ed via Digitalmars-d-learn
On Saturday, 30 April 2016 at 23:11:20 UTC, Laeeth Isharc wrote: All the design/discussion/implementation of this scheme for handling integer overflow would be wasted if it didn’t actually find any bugs in practice. I personally have had quite a few bugs found nearly as I write them, with expre

Setting a list of values

2016-04-30 Thread Joel via Digitalmars-d-learn
This has no effect: _bars.each!(a => { a._plots.fillColor = Color(255, 180, 0); }); I tried putting ..each!((ref a) =>.. with no difference This works: foreach(b; _bars) { b._plots.fillColor = Color(255, 180, 0); }

Using a string generated at compile-time in a @nogc function

2016-04-30 Thread Mithun Hunsur via Digitalmars-d-learn
Hi all, I'm working on removing the string mixins from my code, but have run into an issue: http://dpaste.dzfl.pl/ecd7eb53947e As far as I can tell, this should work; the enum should force compile-time execution (which it does, as evidenced by the pragma). I've worked around this by employi

Re: Can't use std.algorithm.remove on a char[]?

2016-04-30 Thread TheGag96 via Digitalmars-d-learn
On Saturday, 30 April 2016 at 19:21:30 UTC, ag0aep6g wrote: On 30.04.2016 21:08, Jon D wrote: If an initial step is to fix the documentation, it would be helpful to include specifically that it doesn't work with characters. It's not obvious that characters don't meet the requirement. Charact

Re: Setting a list of values

2016-04-30 Thread Ali Çehreli via Digitalmars-d-learn
On 04/30/2016 10:05 PM, Joel wrote: > This has no effect: > _bars.each!(a => { a._plots.fillColor = Color(255, 180, 0); }); This is a common issue especially for people who know lambdas from other languages. :) Your lambda does not do any work. Rather, your lambda returns another lambda, whic