Skip to main content
9 events
when toggle format what by license comment
Aug 15 at 15:52 comment added Loki Astari I now know how to use std::variant. That is a better technique than union.
Jun 12, 2020 at 8:12 comment added Loki Astari @MoritzSchäfer I used a union because I don't know how to use std::variant it's not something I have found the need for yet. Note: I don't use union often either (about twice in thirty years).
Jun 12, 2020 at 7:08 comment added Moritz Schäfer You are using a union for JSONUnion instead of an std::variant because you can't do null = nullptr; with std::variant ?
Jun 11, 2020 at 18:09 comment added Loki Astari @MoritzSchäfer: getIf<int>("nested_object", "numbers", 3) should be able to return the 3 element in "numbers" that is in the member "nested_object" inside your object.
Jun 11, 2020 at 11:49 vote accept Moritz Schäfer
Jun 11, 2020 at 8:58 comment added Moritz Schäfer For clarification, by "The get function assumes you only have objects. You should be able to handle de-referencing arrays. But that requires two types of get parameter (integer and string)." you mean that if I have the attribute "numbers": [1, 2, 3, 4, 5], I should be able to return an individual value of that array ? Maybe I misunderstand you.
Jun 11, 2020 at 7:59 vote accept Moritz Schäfer
Jun 11, 2020 at 11:49
Jun 11, 2020 at 7:10 history edited Jerry Coffin CC BY-SA 4.0
improved formatting, fixed a few typos
Jun 10, 2020 at 22:55 history answered Loki Astari CC BY-SA 4.0