Re: How should I return multiple const values from a function?

2023-01-02 Thread Salih Dincer via Digitalmars-d-learn
On Tuesday, 3 January 2023 at 01:56:10 UTC, Paul Backus wrote: On Monday, 2 January 2023 at 23:25:48 UTC, Charles Hixson wrote: They syntax I wanted was something like: bool func (const out Key k, const out Val v) { k = this.key.dup; v = this.val.dup; return true;    } This works for me:

Re: How should I return multiple const values from a function?

2023-01-02 Thread Charles Hixson via Digitalmars-d-learn
On 1/2/23 17:56, Paul Backus via Digitalmars-d-learn wrote: return Tuple!(const(Key), const(Value))(k, v); Great!  OK, now the code is:     auto    findFirst ()     {    if    (root is null)    {    Key k    =    Key.init;        Val v    =    Val.init;        return Tuple!(co

Re: How should I return multiple const values from a function?

2023-01-02 Thread Paul Backus via Digitalmars-d-learn
On Monday, 2 January 2023 at 23:25:48 UTC, Charles Hixson wrote: They syntax I wanted was something like: bool func (const out Key k, const out Val v) { k = this.key.dup; v = this.val.dup; return true;    } This works for me: import std.typecons; auto func(Key, Value)(Key k, Value

Re: How should I return multiple const values from a function?

2023-01-02 Thread Charles Hixson via Digitalmars-d-learn
On 1/2/23 15:14, Paul Backus via Digitalmars-d-learn wrote: On Monday, 2 January 2023 at 22:53:13 UTC, Charles Hixson wrote: I want to return values of the template parameter type, so there doesn't seem to be any way to dup or idup them. It's hard to say where exactly you're going wrong if y

Re: How should I return multiple const values from a function?

2023-01-02 Thread Charles Hixson via Digitalmars-d-learn
On 1/2/23 15:14, Paul Backus via Digitalmars-d-learn wrote: On Monday, 2 January 2023 at 22:53:13 UTC, Charles Hixson wrote: I want to return values of the template parameter type, so there doesn't seem to be any way to dup or idup them. It's hard to say where exactly you're going wrong if y

Re: How should I return multiple const values from a function?

2023-01-02 Thread Paul Backus via Digitalmars-d-learn
On Monday, 2 January 2023 at 22:53:13 UTC, Charles Hixson wrote: I want to return values of the template parameter type, so there doesn't seem to be any way to dup or idup them. It's hard to say where exactly you're going wrong if you only post the error message, without the code that produced

How should I return multiple const values from a function?

2023-01-02 Thread Charles Hixson via Digitalmars-d-learn
I want to return values of the template parameter type, so there doesn't seem to be any way to dup or idup them.  I don't want the returned values to be able to be used to modify the values held in the table.  const out is an illegal parameter type.  dup doesn't work on ints. So I tried to ret

Re: Address of a class object

2023-01-02 Thread Paul via Digitalmars-d-learn
Thank you, Teoh, Ali, & Matheus

Re: Is there such a JSON parser?

2023-01-02 Thread torhu via Digitalmars-d-learn
On Monday, 2 January 2023 at 21:36:10 UTC, Steven Schveighoffer wrote: On 1/1/23 6:28 PM, torhu wrote: I need to parse some JSON data into various data structures, so I'm looking for a parser based on events or ranges. One that doesn't just load the file and build a data structure that represe

Re: Is there such a JSON parser?

2023-01-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/1/23 6:28 PM, torhu wrote: I need to parse some JSON data into various data structures, so I'm looking for a parser based on events or ranges. One that doesn't just load the file and build a data structure that represents the whole thing. So not std.json, at least. It's pretty rough-edge

Re: Is there such a JSON parser?

2023-01-02 Thread Chris Piker via Digitalmars-d-learn
On Monday, 2 January 2023 at 14:56:27 UTC, SealabJaster wrote: Are you asking for a SAX-styled parser for JSON? I have an upcoming project (about 3-6 months away) that could make use of this as well. If you need someone to try it out please let me know and I'll give it a spin. Good luck on

Re: Handling CheckBox state changes in DLangUI

2023-01-02 Thread torhu via Digitalmars-d-learn
On Saturday, 31 December 2022 at 02:40:49 UTC, Daren Scot Wilson wrote: The compiler errors I get are, for no '&' and with '&': Error: function `app.checkbox_b_clicked(Widget source, bool checked)` is not callable using argument types `()` Error: none of the overloads of `opAssign` are calla

Re: Is there such a JSON parser?

2023-01-02 Thread torhu via Digitalmars-d-learn
On Monday, 2 January 2023 at 14:56:27 UTC, SealabJaster wrote: Are you asking for a SAX-styled parser for JSON? Yes, I actually want to replace a SAX parser.

Re: Is there such a JSON parser?

2023-01-02 Thread torhu via Digitalmars-d-learn
On Monday, 2 January 2023 at 05:44:33 UTC, thebluepandabear wrote: You might want to try the following: https://github.com/libmir/asdf I had a look at that, but I think it just loads the whole file into it's own data structure. And then you can use attributes to get it to fill structs with d

Re: Is there such a JSON parser?

2023-01-02 Thread SealabJaster via Digitalmars-d-learn
On Sunday, 1 January 2023 at 23:28:12 UTC, torhu wrote: I need to parse some JSON data into various data structures, so I'm looking for a parser based on events or ranges. One that doesn't just load the file and build a data structure that represents the whole thing. So not std.json, at least.