Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VERSION define(s) #948

Closed
mark-99 opened this issue Jan 31, 2018 · 6 comments
Closed

VERSION define(s) #948

mark-99 opened this issue Jan 31, 2018 · 6 comments
Assignees
Labels
solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Milestone

Comments

@mark-99
Copy link

mark-99 commented Jan 31, 2018

It would be useful if there was a #define for the version of the package. This would make it easier to transition client code across breaking changes, e.g. the 3.x changes to operator<< and exception types.

Just something like
#define NLOHMANN_JSON_VERSION 30102 // v3.1.2

Some people prefer to use hex, and some split into separate VERSION_MAJOR/MINOR/PATCH, whatever you want.

@nlohmann
Copy link
Owner

Related: #943

@mark-99
Copy link
Author

mark-99 commented Jan 31, 2018

Ah didn't see that.
However meta() is not useful here, you need to conditionally compile via #ifdef which can't be done with a runtime var.

@nlohmann
Copy link
Owner

I understand, and it is the second time within 3 days that someone is asking for this. I'll have a look.

@nlohmann nlohmann self-assigned this Jan 31, 2018
@mark-99
Copy link
Author

mark-99 commented Jan 31, 2018

To illustrate, e.g.:

#if NLOHMANN_JSON_VERSION >= 30000
catch (const json::parse_error& ex)
#else
catch (const std::invalid_input& ex)
#endif
{ /*etc*/ }

@nlohmann
Copy link
Owner

@mark-99 Is e8bf1f6 satisfying your needs?

@nlohmann nlohmann added this to the Release 3.1.0 milestone Jan 31, 2018
@nlohmann nlohmann added the solution: proposed fix a fix for the issue has been proposed and waits for confirmation label Jan 31, 2018
@mark-99
Copy link
Author

mark-99 commented Jan 31, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Projects
None yet
Development

No branches or pull requests

2 participants