Re: std.array oddness

2014-12-14 Thread ketmar via Digitalmars-d-learn
On Sun, 14 Dec 2014 05:15:43 + earthfront via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Saturday, 13 December 2014 at 06:40:41 UTC, ketmar via Digitalmars-d-learn wrote: auto names = File(names.txt) .byLine!(char,char)(KeepTerminator.no, ',')

Re: dub dustmite

2014-12-14 Thread MrSmith via Digitalmars-d-learn
On Friday, 12 December 2014 at 04:25:01 UTC, Vlad Levenfeld wrote: I'm trying to reduce a bug with dub dustmite feature and I must be doing it wrong somehow, my regular dub output looks like this: source/experimental.d(2403): Error: struct experimental.Product!(int[], int[]).Product no

Re: How to share modules when using -shared?

2014-12-14 Thread MrSmith via Digitalmars-d-learn
On Wednesday, 10 December 2014 at 00:44:41 UTC, Justin Whear wrote: I'm trying to build components that I can dynamically link and keep running into an issue with sharing modules between the host and the pluggable components. Assuming a layout like this: host.d -- loads components at

Re: Are there any methods like isDestroyed or isDisposed to detect whether some object is destroyed or not?

2014-12-14 Thread via Digitalmars-d-learn
On Saturday, 13 December 2014 at 21:20:43 UTC, Andrey Derzhavin wrote: import std.stdio; class ObjectAType { bool ok; this() {ok = true;} } void main() { auto a = new ObjectAType; assert(a.ok); destroy(a); assert(!a.ok); // a has been destroyed. } This method of

Re: Wrapping multiple extern (C) declarations in a template

2014-12-14 Thread via Digitalmars-d-learn
On Saturday, 13 December 2014 at 19:03:42 UTC, aldanor wrote: If I now want to have exactly the same module but with all function declarations wrapped as described above, I have to public import it in another module and then do some template magic. However, it wouldn't be possible to retain

Re: SQLLite driver

2014-12-14 Thread via Digitalmars-d-learn
On Sunday, 14 December 2014 at 07:18:46 UTC, Rikki Cattermole wrote: On 14/12/2014 7:35 p.m., Suliman wrote: Yes I used 2.0.65, but after updating compiler the situation did not resolved... http://www.everfall.com/paste/id.php?apd0bfs5z4eg Ah oh, I remember this issue from 2.064 - 2.065.

Compact Printing of Tuples

2014-12-14 Thread Nordlöw
Why arent' Tuples defaultly printed as (1, 2) instead Tuple!(int, int)(1, 2) ? What's the most convenient of tweak this behaviour so I get untyped-printing. Is there a function to convert a Tuple to into a D parameter tuple?

Re: All Unordered Pairs of Elements in a Range

2014-12-14 Thread Nordlöw
On Saturday, 13 December 2014 at 23:08:13 UTC, H. S. Teoh via Digitalmars-d-learn wrote: Sounds like: https://issues.dlang.org/show_bug.cgi?id=6788 T I guess what's missing here is to make it work for ForwardRanges, right?

Re: SQLLite driver

2014-12-14 Thread Suliman via Digitalmars-d-learn
There is also a branch named `develop` which at least compiles, maybe it is usable. how to add to dub this branch?

Re: Compact Printing of Tuples

2014-12-14 Thread Tobias Pankrath via Digitalmars-d-learn
On Sunday, 14 December 2014 at 11:53:21 UTC, Nordlöw wrote: Why arent' Tuples defaultly printed as (1, 2) instead Tuple!(int, int)(1, 2) ? What's the most convenient of tweak this behaviour so I get untyped-printing. Is there a function to convert a Tuple to into a D parameter tuple?

Re: SQLLite driver

2014-12-14 Thread Suliman via Digitalmars-d-learn
On Sunday, 14 December 2014 at 13:33:27 UTC, Suliman wrote: There is also a branch named `develop` which at least compiles, maybe it is usable. how to add to dub this branch? Compiling using dmd... Linking... OPTLINK (R) for Win32 Release 8.00.15 Copyright (C) Digital Mars 1989-2013 All

Re: dub dustmite

2014-12-14 Thread Vlad Levenfeld via Digitalmars-d-learn
No luck, unfortunately.

Re: SQLLite driver

2014-12-14 Thread Nicolas Sicard via Digitalmars-d-learn
On Sunday, 14 December 2014 at 13:47:21 UTC, Suliman wrote: On Sunday, 14 December 2014 at 13:33:27 UTC, Suliman wrote: There is also a branch named `develop` which at least compiles, maybe it is usable. how to add to dub this branch? Compiling using dmd... Linking... OPTLINK (R) for Win32

Re: Are there any methods like isDestroyed or isDisposed to detect whether some object is destroyed or not?

2014-12-14 Thread Dan Olson via Digitalmars-d-learn
Marc Schütz\ schue...@gmx.net writes: On Saturday, 13 December 2014 at 21:20:43 UTC, Andrey Derzhavin wrote: import std.stdio; class ObjectAType { bool ok; this() {ok = true;} } void main() { auto a = new ObjectAType; assert(a.ok); destroy(a); assert(!a.ok); // a

Re: Are there any methods like isDestroyed or isDisposed to detect whether some object is destroyed or not?

2014-12-14 Thread via Digitalmars-d-learn
On Sunday, 14 December 2014 at 16:05:13 UTC, Dan Olson wrote: Marc Schütz\ schue...@gmx.net writes: On Saturday, 13 December 2014 at 21:20:43 UTC, Andrey Derzhavin wrote: import std.stdio; class ObjectAType { bool ok; this() {ok = true;} } void main() { auto a = new ObjectAType;

DUB not passing dflags: [-fPIC] for gdc, ldmd2 only for DMD

2014-12-14 Thread Gabor Mezo via Digitalmars-d-learn
I'm coming from this thread: http://forum.dlang.org/thread/zzjeajhjpzhnvgxqu...@forum.dlang.org I a nutshell: - DUB didn't compile my dynamic library project, and Martin linked me this issue: https://github.com/D-Programming-Language/dub/issues/352. The workaround is to put: dflags: [-fPIC]

How can I define a label inside a switch?

2014-12-14 Thread MachineCode via Digitalmars-d-learn
I used to do it in C but in D it's giving this compile error message: switch case fallthrough - 'use goto case;' if intended Here's the code: switch(value) { // alof of cases here // ... white: // regular label case 'a': case 'c': case 'd':

Re: How can I define a label inside a switch?

2014-12-14 Thread ketmar via Digitalmars-d-learn
On Sun, 14 Dec 2014 18:24:39 + MachineCode via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I used to do it in C but in D it's giving this compile error message: switch case fallthrough - 'use goto case;' if intended Here's the code: switch(value) { // alof of

Re: How can I define a label inside a switch?

2014-12-14 Thread MachineCode via Digitalmars-d-learn
On Sunday, 14 December 2014 at 18:27:28 UTC, ketmar via Digitalmars-d-learn wrote: On Sun, 14 Dec 2014 18:24:39 + MachineCode via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I used to do it in C but in D it's giving this compile error message: switch case fallthrough

Re: How can I define a label inside a switch?

2014-12-14 Thread Meta via Digitalmars-d-learn
On Sunday, 14 December 2014 at 18:41:54 UTC, MachineCode wrote: The labels are disabled then? I find that goto case case_value ugly and prefer goto labelName; but if it's the only way to go let's do it I'm not sure if it's intentionally not supported, or just an oversight. Probably the

Re: How can I define a label inside a switch?

2014-12-14 Thread ketmar via Digitalmars-d-learn
On Sun, 14 Dec 2014 18:48:15 + Meta via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Sunday, 14 December 2014 at 18:41:54 UTC, MachineCode wrote: The labels are disabled then? I find that goto case case_value ugly and prefer goto labelName; but if it's the only way to

Re: Compact Printing of Tuples

2014-12-14 Thread bearophile via Digitalmars-d-learn
Nordlöw: Why arent' Tuples defaultly printed as (1, 2) instead Tuple!(int, int)(1, 2) ? What's the most convenient of tweak this behaviour so I get untyped-printing. Is there a function to convert a Tuple to into a D parameter tuple? I'd like a shorter representation of tuples

Fast matrix struct

2014-12-14 Thread Ryan via Digitalmars-d-learn
I'm writing a Matrix struct that I plan to use for some number crunching, which will be intensive at times. So I want it to be fast. Will I do better by manually managing the memory myself with malloc and free in the constructors/destructor or just using plain D arrays? The manual way I

Fastest Way to Append Multiple Elements to an Array

2014-12-14 Thread Nordlöw
What's the fastest way to append multiple elements to an array?: Either arr ~= e1; arr ~= e2; arr ~= e3; or arr ~= [e1,e2,e3]; or some other trick?

Re: Fastest Way to Append Multiple Elements to an Array

2014-12-14 Thread zeljkog via Digitalmars-d-learn
On 15.12.14 00:16, Nordlöw wrote: or some other trick? void append(T, Args...)(ref T[] arr, Args args){ arr.length += args.length; foreach(i, e; args) arr[$ - args.length + i] = args[i]; } void main() { int[] arr = [1, 2, 3, 4, 5]; arr.append(3, 10, 14); writeln(arr); } output:

Re: Fastest Way to Append Multiple Elements to an Array

2014-12-14 Thread Nordlöw
On Sunday, 14 December 2014 at 23:52:15 UTC, zeljkog wrote: void append(T, Args...)(ref T[] arr, Args args){ arr.length += args.length; foreach(i, e; args) arr[$ - args.length + i] = args[i]; } Isn't this algorithm already encoded somewhere in Phobos?

Re: Fastest Way to Append Multiple Elements to an Array

2014-12-14 Thread zeljkog via Digitalmars-d-learn
On 15.12.14 01:00, Nordlöw wrote: Isn't this algorithm already encoded somewhere in Phobos? I don't know.

Re: Fastest Way to Append Multiple Elements to an Array

2014-12-14 Thread anonymous via Digitalmars-d-learn
On Sunday, 14 December 2014 at 23:52:15 UTC, zeljkog wrote: On 15.12.14 00:16, Nordlöw wrote: or some other trick? void append(T, Args...)(ref T[] arr, Args args){ arr.length += args.length; foreach(i, e; args) arr[$ - args.length + i] = args[i]; } void main() { int[] arr = [1, 2,

Re: Fast matrix struct

2014-12-14 Thread anonymous via Digitalmars-d-learn
On Sunday, 14 December 2014 at 22:14:55 UTC, Ryan wrote: I'm writing a Matrix struct that I plan to use for some number crunching, which will be intensive at times. So I want it to be fast. Will I do better by manually managing the memory myself with malloc and free in the

Re: scope block do not handle failure, but try-catch does

2014-12-14 Thread drug via Digitalmars-d-learn
On 13.12.2014 23:26, Suliman wrote: I reread docs and understood that scope not for such case. Next code is do what I need: try { string dbname = config.getKey(dbname); string dbpass = config.getKey(dbpass); string dbhost = config.getKey(dbhost); string dbport = config.getKey(dbport); } catch