Skip to content

Json::Value: Refactor common code in all constructors to an initBasic() function. #68

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

Merged

Conversation

BillyDonahue
Copy link
Contributor

This reduces 8 lines to 2 lines in 12 places.
There shouldn't be a performance hit, as Value fields are POD.

@BillyDonahue BillyDonahue changed the title Refactor common code in all constructors to an initBasic() function. Json::Value: Refactor common code in all constructors to an initBasic() function. Nov 10, 2014
@jacobsa
Copy link
Contributor

jacobsa commented Nov 10, 2014

Sigh, another argument for requiring C++11 (so that we can get delegated constructors). We should just go ahead and do it.

jacobsa added a commit that referenced this pull request Nov 10, 2014
Json::Value: Refactor common code in all constructors to an initBasic() function.
@jacobsa jacobsa merged commit 20672ed into open-source-parsers:master Nov 10, 2014
@BillyDonahue
Copy link
Contributor Author

Thanks for the merge.

I think it may be too early to depend on C++11 expect in specialized builds. I've tried making C++11 extensions to jsoncpp and ran into some difficulty (experiment was on Mac). You have to be careful about any C++11 features that are exposed in the headers, because then every user has to compile with the same -std=c++11 flag that the library was built with, and this isn't the default. Managing that is going to be tricky, maybe requiring that a user produce different libraries for different language versions?

@cdunn2001
Copy link
Contributor

Ugh! I thought C++11 would make life easier, not harder.

I should note that Debian just made their fork over the weekend, based on the current tip. So Debian will not have these int64 changes, etc.

Btw, did you know that Cereal (boost::serialization drop-in replacement) provides optional jsoncpp integration? I wouldn't be surprised if that were dropped someday, but it's there for now. Maybe you could learn something from Cereal's C++11 support.

@BillyDonahue
Copy link
Contributor Author

@cdunn2001 : Cereal just unconditionally goes for it.
https://github.com/USCiLab/cereal/blob/master/CMakeLists.txt#L4

@cdunn2001
Copy link
Contributor

I'm fine with that. If anybody cannot use C++11, then can check out from our pre-C++11 branch. If you don't modify the old code, then we can't break it! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants