-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Cannot assign string to a json value #871
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
Comments
I disagree unless there’s a functional difference between operator= and an
assign member function. I guess the parenthetical and operator precedence
are different.
But operator= is pretty standard!
When you said “explicit” did you mean “implicit”?
It can be argued whether they are good or bad, I guess. I like them. I
think we should be more complete though. If we have an implicit constructor
from T, we should provide operators like assignment directly from T as
well, so we aren’t doing more work than we need to, converting to Value and
then assigning from the temporary Value. This gets expensive for
relationals where you are making a Value just to throw it out.
On Sat, Jan 19, 2019 at 3:27 AM PavelP ***@***.***> wrote:
That's kind of crazy the problem exists in the library, but the most
obvious thing doesn't seem to work:
Json::Value jmessage;
std::string sdp;
jmessage["something"] = sdp;
this results in a link error:
error LNK2019: unresolved external symbol "public: class Json::Value &
__thiscall Json::Value::operator=(class Json::Value const &)"
I get this error with when using # define JSONCPP_VERSION_STRING "1.6.5"
If I take current git it doesn't even compile:
2>json/json.h(298): error C2065: 'SecureAllocator': undeclared identifier
In general, those explicit constructors that construct string to
Json::Value aren't a good idea IMO. Library should also provide .assign
methods.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#871>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AHFzPKRWci3vWG1NYBQlhKXqMwoU6y3Bks5vEtb9gaJpZM4aJB6u>
.
--
ǝnɥɐuop ʎllıq
|
No difference, but jsoncpp could like most containers provide
Yes, I meant implicit (corrected). I like them too, until they cause unexpected issues.
Supposedly passing by value and swapping it out should be ok (off course assigning directly would be better), but I have no idea why VS2015 gives a link error in this piece of code. If I change that |
I just tried minimal example:
and it works with non-amalgamated version and fails to compile with amalgamated one. So, something isn't right with the amalgamation as it results in different results. |
Closing due to inactivity, and looks like it may have been fixed in other patches. |
That's kind of crazy the problem exists in the library, but the most obvious thing doesn't seem to work:
this results in a link error:
I get this error with when using
# define JSONCPP_VERSION_STRING "1.6.5"
If I take current git it doesn't even compile:
2>json/json.h(298): error C2065: 'SecureAllocator': undeclared identifier
In general, those implicit constructors that construct string to Json::Value aren't a good idea IMO. Library should also provide
.assign
methods. In both case I use amalgamated versionThe text was updated successfully, but these errors were encountered: