You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To detect the version of the used library (both in case of support requests and also to detect the version in a binary), we should add a function that returns a version string and a UUID.
It'd be nice if I could programmatically get the version number of this library too, rather than manually changing a hard-coded value after each update:
@whackashoe I did not plan to provide such diagnostic information. I had a different goal: I would like to get a string into binaries using the library so that I can detect the library later on.
Afaik it just shows default, not necessarily what people are using. What I have seen in a few programs, take ffmpeg for example where it gives version, copyright, compiler + version _ os, flags... its full blown suite compared to json so I mean that might be overkill but meh.. a feature like this isn't really "stl" like, but might be helpful. I think the whole reason they included it was just for ease of reporting so sorta similar deal. Really a matter of taste of how much cruft you wanna include :)
I recommend ripping the major/minor/patch out to constexprs and tossing them near the top so people could quickly see what version with just a quick opening of file.
name seems unnecessary.
url might be better name-suited to repo or something assuming the users of forked versions would change the url to reflect their mod. (very subjective, idk if I even agree with this statement- just off-the-cuff thought)
copyright year range isn't necessary, it's just a signal to others how long its been going on, however this is easily found in git history. Might make sense to just go w/ "author": "Niels Lohmann" so people could credit you easily without having to remove the (C) x-x bit or retype your name (the horror).
If the function is going to return more than basic version information for the library, using a different name such as diagnostics(), info() or meta() might be a better idea. version()["copyright"] and the like don't quite make sense, and version()["version"] sounds repetitive.
Activity
erengy commentedon Dec 19, 2016
In my application's About dialog, third-party components are listed in the following manner:
It'd be nice if I could programmatically get the version number of this library too, rather than manually changing a hard-coded value after each update:
I was planning to open an issue for this, so I'm happy to see that it's going to be in an upcoming release.
whackashoe commentedon Dec 20, 2016
Some of these might be useful too
nlohmann commentedon Dec 20, 2016
@whackashoe I did not plan to provide such diagnostic information. I had a different goal: I would like to get a string into binaries using the library so that I can detect the library later on.
whackashoe commentedon Dec 20, 2016
Ahh.. ok. I had thought what you meant above wrt for support requests it might be useful to be able to have some diagnostics.
nlohmann commentedon Dec 21, 2016
For diagnostics, would not be
cmake --system-informationmore helpful?whackashoe commentedon Dec 21, 2016
Not really, usually wont have the same info that the user is building their actual project with.
nlohmann commentedon Dec 21, 2016
But I guess they may answer questions on the used compiler, version, and OS. At least I never had the need to get these details programmatically.
whackashoe commentedon Dec 21, 2016
Afaik it just shows default, not necessarily what people are using. What I have seen in a few programs, take ffmpeg for example where it gives version, copyright, compiler + version _ os, flags... its full blown suite compared to json so I mean that might be overkill but meh.. a feature like this isn't really "stl" like, but might be helpful. I think the whole reason they included it was just for ease of reporting so sorta similar deal. Really a matter of taste of how much cruft you wanna include :)
🚧 started working on #397
nlohmann commentedon Dec 30, 2016
I implemented a
version()function which returns a JSON like this:Any thoughts on this?
whackashoe commentedon Dec 30, 2016
I recommend ripping the major/minor/patch out to constexprs and tossing them near the top so people could quickly see what version with just a quick opening of file.
nameseems unnecessary.urlmight be better name-suited torepoor something assuming the users of forked versions would change the url to reflect their mod. (very subjective, idk if I even agree with this statement- just off-the-cuff thought)copyrightyear range isn't necessary, it's just a signal to others how long its been going on, however this is easily found in git history. Might make sense to just go w/"author": "Niels Lohmann"so people could credit you easily without having to remove the(C) x-xbit or retype your name (the horror).nlohmann commentedon Dec 31, 2016
erengy commentedon Jan 2, 2017
If the function is going to return more than basic version information for the library, using a different name such as
diagnostics(),info()ormeta()might be a better idea.version()["copyright"]and the like don't quite make sense, andversion()["version"]sounds repetitive.nlohmann commentedon Jan 2, 2017
@erengy This is a valid point, and I like the name
meta()for it.nlohmann commentedon Jan 8, 2017
FYI: Renamed the function to
meta()in dd45ba6🔀 merge branch 'feature/release_information' into develop #397