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
{{ message }}
Repository navigation
Json should not be constructible with 'json*' #448
Maybe the default to_/from_json should be implemented just for the common C++ types (bool, std::string, std::map, std::vector) and not in terms of BasicJson::whatever_t, and if you specialize basic_json then you have to also manually opt-in to the right to_/from_json overloads?
If I remember correctly, there was a constructor for each BasicJsonType:: whatever _t prior to 2.1.0.
So I think we should keep those overloads for now, to keep backward compatibility.
To avoid this implicit conversion, I guess a simple std::is_same<typename BasicJsonType::boolean_t, T> in the enable_if will do the trick. It would be great to fix similar issues with different parameter types (integers and so on)
Unfortunately I don't have a laptop at hand until Sunday to test this
Activity
jaredgrubb commentedon Feb 12, 2017
Maybe the default to_/from_json should be implemented just for the common C++ types (bool, std::string, std::map, std::vector) and not in terms of BasicJson::whatever_t, and if you specialize basic_json then you have to also manually opt-in to the right to_/from_json overloads?
theodelrieu commentedon Feb 13, 2017
If I remember correctly, there was a constructor for each
BasicJsonType:: whatever _tprior to 2.1.0.So I think we should keep those overloads for now, to keep backward compatibility.
To avoid this implicit conversion, I guess a simple
std::is_same<typename BasicJsonType::boolean_t, T>in the enable_if will do the trick. It would be great to fix similar issues with different parameter types (integers and so on)Unfortunately I don't have a laptop at hand until Sunday to test this
nlohmann commentedon Feb 13, 2017
@theodelrieu I agree in both points, and I think I won't have time to fix this this week either.
jaredgrubb commentedon Feb 14, 2017
I have done this and it seems to work:
I'm not 100% that the decay is necessary.
🚑 fix for #448
nlohmann commentedon Feb 19, 2017
Fixed using @jaredgrubb 's proposal.
theodelrieu commentedon Feb 20, 2017
I don't think the decay is useful, but that's a minor thing.
Thanks for the fix!
nlohmann commentedon Feb 20, 2017
I shall remove the decay then.
🚧 removed decay (#448)