Internal error mixing templates and CTFE

2017-09-14 Thread David Bennett via Digitalmars-d-learn
Hi Guys, I've been playing around with CTFE today to see how far I would push it but I'm having an issue appending to an array on a struct in CTFE from a template: ``` struct Content{ string[] parts; } void add_part_to_content(Content content, string s)(){ content.parts ~= "Part: "~s

Re: failed loading freetype 2.6 via derelict-ft

2017-09-14 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 13 September 2017 at 22:18:07 UTC, Mike Parker wrote: Missing symbols usually mean a version mismatch. The latest DerelictFT requires FreeType 2.6 or later. It could also mean your shared library was compiled without bzip2 support. I'm on my phone right now else I'd check it m

Re: DerelictGL3 slow compilation speed with contexts

2017-09-14 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 13 September 2017 at 16:30:34 UTC, Igor wrote: I tested it again with my entire project and it seems it is not inline thing but -O (optimized build). You can checkout the project here: https://github.com/igor84/dngin if you try to build it with "dub build -ax86_64 -b release"

extern(C) enum

2017-09-14 Thread bitwise via Digitalmars-d-learn
I translated the headers for FreeType2 to D, and in many cases, enums are used as struct members. If I declare an extern(C) enum in D, is it guaranteed to have the same underlying type and size as it would for a C compiler on the same platform?

Re: How to check if path is writable

2017-09-14 Thread Daniel Kozak via Digitalmars-d-learn
You can use https://dlang.org/phobos/std_file.html#getAttributes, but you still need to distinguish Windows and posix platforms On Fri, Sep 15, 2017 at 5:36 AM, Joseph via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Friday, 15 September 2017 at 02:02:54 UTC, Neia Neutulad

Access Violation when passing the result of a C function directly to a D function?

2017-09-14 Thread Timothy Foster via Digitalmars-d-learn
I'm compiling on Windows 7 x64, DMD32 D Compiler v2.075.1 and I'm using Derelict Fmod to handle audio in my application. Every Fmod function returns an int telling me if the function ran okay, or if there was an error. I've written the following helper function that will print something for me

Re: How to check if path is writable

2017-09-14 Thread Joseph via Digitalmars-d-learn
On Friday, 15 September 2017 at 02:02:54 UTC, Neia Neutuladh wrote: On Friday, 15 September 2017 at 01:42:02 UTC, Joseph wrote: Is there a cross-platform way in D to check if a path is writable? Try to write to it and see if you get an error. Um, so I have to do this for every platform? I th

Re: How to check if path is writable

2017-09-14 Thread Neia Neutuladh via Digitalmars-d-learn
On Friday, 15 September 2017 at 01:42:02 UTC, Joseph wrote: Is there a cross-platform way in D to check if a path is writable? Try to write to it and see if you get an error.

How to check if path is writable

2017-09-14 Thread Joseph via Digitalmars-d-learn
Is there a cross-platform way in D to check if a path is writable?

Re: Ranges suck!

2017-09-14 Thread Ali Çehreli via Digitalmars-d-learn
On 09/14/2017 04:53 PM, Your name wrote: > Why can't I simply do somestring.strip("\n")??? Actually, you can but that's a different one: std.algorithm.strip and it takes the element type, so you should provide a char: somestring = somestring.strip('\n'); (Note: I lied about element type

Re: Ranges suck!

2017-09-14 Thread Brad Anderson via Digitalmars-d-learn
On Thursday, 14 September 2017 at 23:53:20 UTC, Your name wrote: Every time I go to use something like strip it bitches and gives me errors. Why can't I simply do somestring.strip("\n")??? import std.string would be the likely strip yet it takes a range and somestring, for some retarded reason

Ranges suck!

2017-09-14 Thread Your name via Digitalmars-d-learn
Every time I go to use something like strip it bitches and gives me errors. Why can't I simply do somestring.strip("\n")??? import std.string would be the likely strip yet it takes a range and somestring, for some retarded reason, isn't a range. strip isn't the only function that does this. Wh

Re: Is there any threadsafe queue?

2017-09-14 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Wednesday, 13 September 2017 at 22:54:06 UTC, Seb wrote: https://code.dlang.org/packages/lock-free That package has a single-reader single-writer queue, exactly what the OP asked for.

Re: Is there any threadsafe queue?

2017-09-14 Thread Bienlein via Digitalmars-d-learn
On Wednesday, 13 September 2017 at 07:51:19 UTC, John Burton wrote: Is there any threadsafe queue in the standard library? I've not been able to find anything but thought I'd check before making my own. I want to be able to assemble messages (Which are just streams of bytes) in one thread int