Re: Local static class fields

2019-08-14 Thread Bert via Digitalmars-d-learn
On Tuesday, 13 August 2019 at 12:22:45 UTC, Simen Kjærås wrote: On Tuesday, 13 August 2019 at 08:41:02 UTC, Bert wrote: On Tuesday, 13 August 2019 at 04:43:29 UTC, Paul Backus wrote: It seems to me like the obvious solution is to use two different classes, one to store the global state, and

Re: Local static class fields

2019-08-14 Thread Bert via Digitalmars-d-learn
On Tuesday, 13 August 2019 at 00:17:13 UTC, DanielG wrote: On Monday, 12 August 2019 at 22:48:43 UTC, Bert wrote: I have a recursive class structure(think of a graph or tree) and I need to keep a global state for it, If I'm understanding the problem correctly, it seems like you have a choice

Re: Abstract classes vs interfaces, casting from void*

2019-08-14 Thread wjoe via Digitalmars-d-learn
On Saturday, 10 August 2019 at 08:20:46 UTC, John Colvin wrote: On Friday, 9 August 2019 at 13:39:53 UTC, Simen Kjærås wrote: Thanks for the extra detail. Is there a solid reason to ever use an interface over an abstract class? (Other than multiple inheritance). I'm such a noob at

can DDOC generate files names including the full path ?

2019-08-14 Thread wjoe via Digitalmars-d-learn
For example if the source tree looks like this: source/ foo/ baz.d bar/ baz.d and generating the docs with something like this: dmd -D -Dd=docs foo/baz.d bar/baz.d the output looks like this: docs/ baz.html one baz overwrites the other. I'd like to have something like

error : outer function context of `D main` is needed to `new` nested class `main.main.X`

2019-08-14 Thread Bert via Digitalmars-d-learn
void main() { class X { ... } auto f = foo!X; } then in another module I have a templated function foo that simply new's x: auto foo(T)() { return new T; } yet I get the error. I realize that X is local to main and I realize I could do something like foo(new X); but that

Re: error : outer function context of `D main` is needed to `new` nested class `main.main.X`

2019-08-14 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 15 August 2019 at 01:55:17 UTC, Bert wrote: void main() { class X { ... } I would just make it `static class X` and then it shoudl work fine. Won't be able to access main's local variables then though, but you could pass the necessary ones through the constructors or

Re: Is it possible to target all platforms that Qt Quick can target?

2019-08-14 Thread Enjoys Math via Digitalmars-d-learn
I cannot use QML for D or other D Qt libraries. I'm writing something important and need all of Qt Creator and its C++ editing environment. I don't wish to go through the bad experience of using those libraries. I've tried it before. I do D in Visual D, and that would be for the backend

Re: Desktop app with vibe.d

2019-08-14 Thread wjoe via Digitalmars-d-learn
On Monday, 12 August 2019 at 10:41:57 UTC, GreatSam4sure wrote: Pls I want to know if it is possible to build desktop app with vibe.d just like nodejs. I am not satisfy with the GUI of Dlang such as dlangui and gtkd. I don't think they have good styling capabilities like HTML and CSS. I will

Re: How should I sort a doubly linked list the D way?

2019-08-14 Thread Patrick Schluter via Digitalmars-d-learn
On Tuesday, 13 August 2019 at 18:28:35 UTC, Ali Çehreli wrote: On 08/13/2019 10:33 AM, Mirjam Akkersdijk wrote: > On Tuesday, 13 August 2019 at 14:04:45 UTC, Sebastiaan Koppe wrote: >> Convert the nodes into an D array, sort the array with nodes.sort!"a.x >> < b.x" and then iterate the array

Re: How should I sort a doubly linked list the D way?

2019-08-14 Thread Ali Çehreli via Digitalmars-d-learn
On 08/13/2019 03:12 PM, Mirjam Akkersdijk wrote: > For the application I am writing, it makes very much sense to use a DLL. Yes, Dynamically Linked Libraries can be useful. Oh wait... You mean Doubly-Linked List. :o) > I tried setting the length first and iterating through it with `nodes[i]

Re: string to ubyte[]

2019-08-14 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 14 August 2019 at 15:11:44 UTC, berni wrote: The reason is, that this expression creates a string and not a ubyte[]... it should be ok to just cast it in this case.

string to ubyte[]

2019-08-14 Thread berni via Digitalmars-d-learn
I've got a function which takes two strings and should return them as a ubyte[] with additional zero bytes in between and around. This works: ubyte[] convert_string_pair(string first, string second) { auto b = new ubyte[](0); b ~= 0x00 ~ first ~ 0x00 ~ second ~ 0x00;

Re: string to ubyte[]

2019-08-14 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Aug 14, 2019 at 03:11:44PM +, berni via Digitalmars-d-learn wrote: [...] > but unfortunately this does not work: > > >ubyte[] convert_string_pair(string first, string second) > >{ > >return 0x00 ~ first ~ 0x00 ~ second ~ 0x00; > >} > > The reason is, that this