Timeline for Minimal JSON Parser
Current License: CC BY-SA 4.0
11 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 12, 2019 at 9:03 | comment | added | L. F. | @Saxpy Oops, I didn’t realize that the string view ctor is explicit. Sorry, I’ll reconsider the recommendation | |
| Oct 11, 2019 at 17:57 | comment | added | Saxpy |
sv + sv and sv + s fails on both Clang 8 and MSVC2019. I found this link from 2 years ago, but in any case I'd still prefer using a plain string as it is meant to be appended anyways.
|
|
| Oct 11, 2019 at 10:11 | comment | added | L. F. |
@Saxpy You can still do sv + sv or sv + s because is_constructible<string, string_view>.
|
|
| Oct 10, 2019 at 17:34 | comment | added | Saxpy |
IIRC string_view is supposed to be a read-only view of a c-string. string_view contains no APIs for mutations, only reducing the view.
|
|
| Oct 10, 2019 at 9:54 | comment | added | L. F. | @Saxpy Can you elaborate on “string view does not offer append operations”? You can concatenate them just like ordinary strings. | |
| Oct 9, 2019 at 16:55 | comment | added | Saxpy |
I see, I'll go ahead and change it to private inheritance. Also I'll take note on the public: blocks into // constructors. I'd still like to keep trailing returns at this is my personal project and that's the style I've committed too and prefer on my own. string_view does not offer append operations though, how could I refactor this? The std::map will be const.
|
|
| Oct 9, 2019 at 9:47 | comment | added | L. F. |
@Saxpy "Is-a" should be indicated by private inheritance, not protected inheritance. Don't abuse multiple public: labels, which alter semantics, for separating declaration blocks; using a comment like // constructors instead is much clearer. Always trailing return is a, well, unpopular, and illogical style (coding styles exist to improve readability). string_view provides the operations you want. Keeping the map is understandable though, but at least make it const.
|
|
| Oct 8, 2019 at 19:28 | comment | added | Saxpy |
ah two more notes: I can't use std::string_view for prefix because I require append operations to tabify my json -> file operation, second I use a std::map lookup table even if it is overkill because its easy to read and I will be adding my own custom keywords for my fighting game.
|
|
| Oct 8, 2019 at 19:18 | comment | added | Saxpy |
I've gone ahead and made all the corrections except the follow (please refute me if I am wrong): #pragma once it is a header file, protected aggregate_t because a json IS-A variant, not HAS-A variant, multiple public: labels separates my ctors / API and trailing returns is my coding style (I would change depending on my org).
|
|
| Oct 8, 2019 at 19:09 | vote | accept | Saxpy | ||
| Oct 6, 2019 at 11:40 | history | answered | L. F. | CC BY-SA 4.0 |