-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add Move constructors #264
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
Conversation
Add move constructor to Value::CZString, also compile and run unit tests.
#define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) | ||
#endif | ||
#if defined(_MSC_VER) // MSVC | ||
#if _MSC_VER <= 1200 // MSVC 6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't indent preprocessor directives. It's churning the diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you think it makes the conditions much more readable?
I have no problem to adhere to the coding standards of the project if you think that's better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the indents as written improve the clarity of the file overall.
The usual thing is to keep the #
in column 1. This is historical convention.
The next token is indented by 0, 1, or 2 spaces. In this project, it's 0, but you've chosen 8.
The idea is to keep the preprocessor lines visually segregated from the C++ code.
A reader can eyeball column 1 and see a run of #
, which is easy.
…tested" This reverts parts of commit df0dc46.
* Fix indentation * Allow includer to specify in advance the value for JSON_HAS_RVALUE_REFERENCES
I rebased onto Don't worry about compatibility. We'll deal with that. |
Rebased by @cdunn2001 in #267, closing this pull request |
I have a question: Why do we need to add the move ctor if the default version is provided automatically? ... Oh, I guess the rules for this have evolved. But could we use the new |
Yeah, if you have a destructor or a copy constructor then the move Even if this is not the case from a practical point of view I don't think I think we could have done something like:
But not all current compilers support this either :( Note: I originally replied to your email which didn't contain the |
Oh, I sometimes update the comment for clarity. I guess that doesn't send a new e-mail. Thanks, Motti. |
The implicit move ops don't work for resource-managing classes like |
@BillyDonahue good point! |
Add move constructors to Json::Value and Json::Value::CZString
As requested by issue #223: Json::Value should support move semantics