Re: Static Length Propagation of Ranges

2016-10-20 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 20 October 2016 at 16:25:53 UTC, Meta wrote: On Thursday, 20 October 2016 at 13:05:05 UTC, Nordlöw wrote: On Thursday, 20 October 2016 at 12:38:40 UTC, Nordlöw wrote: ElementType!R[n] arrayN(size_t n, R)(R r) { assert(r.length == n); typeof(return) dst; import

Re: Dustmite can't handle my memory segfault

2016-10-20 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 20 October 2016 at 21:33:59 UTC, Nordlöw wrote: I need your help here, I'm complete stuck. Vladimir? If you see output even after redirecting stdout and stderr, the program is probably writing to /dev/tty or similar. I'm not sure what the "proper" way is to run a program

Re: Sorted ranges in combined sorted order?

2016-10-20 Thread Ali Çehreli via Digitalmars-d-learn
On 10/20/2016 02:15 PM, Nordlöw wrote: On Thursday, 20 October 2016 at 21:14:14 UTC, Nordlöw wrote: Given a range of ranges where individual ranges are already Ahh, my mistake. It's https://dlang.org/phobos/std_algorithm_setops.html#.NWayUnion you're looking for, right? Thanks! That's

Dustmite can't handle my memory segfault

2016-10-20 Thread Nordlöw via Digitalmars-d-learn
I'm struggling with finding a memory management problem in my latest array container (non-RC just C++-style) at https://github.com/nordlow/phobos-next/blob/master/src/array_ex.d When I run the program separately my terminal spits out *** Error in `./array_ex': corrupted double-linked list:

Re: Sorted ranges in combined sorted order?

2016-10-20 Thread Nordlöw via Digitalmars-d-learn
On Thursday, 20 October 2016 at 21:14:14 UTC, Nordlöw wrote: Given a range of ranges where individual ranges are already Ahh, my mistake. It's https://dlang.org/phobos/std_algorithm_setops.html#.NWayUnion you're looking for, right?

Re: Sorted ranges in combined sorted order?

2016-10-20 Thread Nordlöw via Digitalmars-d-learn
On Thursday, 20 October 2016 at 20:49:38 UTC, Ali Çehreli wrote: Given a range of ranges where individual ranges are already sorted, is there anything in Phobos that can visit the combined range in sorted order? Although the range elements are not necessarily arrays, e.g. [ [ 3, 10, 20 ]

Sorted ranges in combined sorted order?

2016-10-20 Thread Ali Çehreli via Digitalmars-d-learn
Given a range of ranges where individual ranges are already sorted, is there anything in Phobos that can visit the combined range in sorted order? Although the range elements are not necessarily arrays, e.g. [ [ 3, 10, 20 ] [ 1, 2, 7 ] [ 5, 6 ] ] The elements should appear

Re: Typesafe variadic argument taking struct

2016-10-20 Thread Meta via Digitalmars-d-learn
On Thursday, 20 October 2016 at 14:29:53 UTC, Satoshi wrote: Oh, really? I didn't notice that... (sarcasm) If I change struct Foo to class Foo it works. It's because for some weird reason, this type of varargs allows implicit construction of an object. I don't know why, it's just a feature

Re: Typesafe variadic argument taking struct

2016-10-20 Thread Satoshi via Digitalmars-d-learn
On Thursday, 20 October 2016 at 16:04:00 UTC, Nordlöw wrote: On Thursday, 20 October 2016 at 12:48:34 UTC, Satoshi wrote: Hello, why ... cannot be used with structs? struct Foo { this(int a) { } } void bar(Foo foo...) { } bar(42); Being explicit about these things makes complex code

Re: Static Length Propagation of Ranges

2016-10-20 Thread Meta via Digitalmars-d-learn
On Thursday, 20 October 2016 at 13:05:05 UTC, Nordlöw wrote: On Thursday, 20 October 2016 at 12:38:40 UTC, Nordlöw wrote: ElementType!R[n] arrayN(size_t n, R)(R r) { assert(r.length == n); typeof(return) dst; import std.algorithm.mutation : copy; r.copy(dst[]); return dst; }

Re: Typesafe variadic argument taking struct

2016-10-20 Thread Nordlöw via Digitalmars-d-learn
On Thursday, 20 October 2016 at 12:48:34 UTC, Satoshi wrote: Hello, why ... cannot be used with structs? struct Foo { this(int a) { } } void bar(Foo foo...) { } bar(42); Being explicit about these things makes complex code more clear.

Re: Typesafe variadic argument taking struct

2016-10-20 Thread Satoshi via Digitalmars-d-learn
On Thursday, 20 October 2016 at 12:52:42 UTC, rikki cattermole wrote: On 21/10/2016 1:48 AM, Satoshi wrote: Hello, why ... cannot be used with structs? struct Foo { this(int a) { } } void bar(Foo foo...) { } bar(42); Because an int is not a Foo. Oh, really? I didn't notice that...

Re: About debugging (again)

2016-10-20 Thread ANtlord via Digitalmars-d-learn
On Monday, 17 October 2016 at 19:17:25 UTC, Basile B. wrote: On Monday, 17 October 2016 at 19:14:49 UTC, ANtlord wrote: redirect to ddemangle, that's its job. Do you know the way how to redirect? I've tried as you have written above and this makes impossible to type any command to gdb.

Re: Static Length Propagation of Ranges

2016-10-20 Thread Nordlöw via Digitalmars-d-learn
On Thursday, 20 October 2016 at 12:38:40 UTC, Nordlöw wrote: ElementType!R[n] arrayN(size_t n, R)(R r) { assert(r.length == n); typeof(return) dst; import std.algorithm.mutation : copy; r.copy(dst[]); return dst; } Is there a place for part of this logic in Phobos? I'm

Re: Typesafe variadic argument taking struct

2016-10-20 Thread rikki cattermole via Digitalmars-d-learn
On 21/10/2016 1:48 AM, Satoshi wrote: Hello, why ... cannot be used with structs? struct Foo { this(int a) { } } void bar(Foo foo...) { } bar(42); Because an int is not a Foo.

Typesafe variadic argument taking struct

2016-10-20 Thread Satoshi via Digitalmars-d-learn
Hello, why ... cannot be used with structs? struct Foo { this(int a) { } } void bar(Foo foo...) { } bar(42);

Re: Static Length Propagation of Ranges

2016-10-20 Thread Nordlöw via Digitalmars-d-learn
On Wednesday, 19 October 2016 at 19:39:46 UTC, Nordlöw wrote: On Wednesday, 19 October 2016 at 19:01:50 UTC, Meta wrote: https://goo.gl/t9m3YK I'm actually pretty impressed that this kind of code can be written in D. Thanks! Add at

Re: Any recent success with SWIG?

2016-10-20 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-10-19 18:38, Ryan wrote: I would like to use a library with a c interface from D (gdal actually), but I can't find any bindings. I've looked at htod, but I also see that gdal has project maintained SWIG interfaces and SWIG claims to work with D (both D1 and D2). So I installed the

Re: Conditional Compilation Multiple Versions

2016-10-20 Thread Claude via Digitalmars-d-learn
On Saturday, 13 June 2015 at 12:21:50 UTC, ketmar wrote: On Fri, 12 Jun 2015 20:41:59 -0400, bitwise wrote: Is there a way to compile for multiple conditions? Tried all these: version(One | Two){ } version(One || Two){ } version(One && Two){ } version(One) | version(Two){ } version(One) ||

Re: Meta-programming: iterating over a container with different types

2016-10-20 Thread Claude via Digitalmars-d-learn
On Friday, 23 September 2016 at 12:55:42 UTC, deed wrote: // Maybe you can try using std.variant? Thanks for your answer. However I cannot use variants, as I have to store the components natively in a void[] array (for cache coherency reasons). So I found a way to solve that problem:

Re: Render SVG To Display And Update Periodically

2016-10-20 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 20 October 2016 at 04:52:11 UTC, Jason C. Wells wrote: This is probably a general programming question. I'll follow up here since this thread is the inspiration for my current question. When attempting to compile simpledisplay.d, I get the following: C:\...\dlang\arsd-master>dmd