-
-
Notifications
You must be signed in to change notification settings - Fork 390
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
crow::json::wvalue lacks an 'object' initialization and assignment. #189
Comments
Hi @lcsdavid, There absolutely is interest in every new addition or improvement. Thanks for pointing this out and proposing a solution. A PR would be great, and if you want to go the extra mile you can add to the existing examples and unit tests. Though it's not strictly necessary. Thanks again for pointing out both the problem and a solution. |
I'll do a PR probably this week-end so. Thanks for your feedback. |
crow::json::wvalue
lacks an explicitobject
initialization and assignment.Currently to initialize a
crow::json:wvalue
we need to default construct the object and then populate values, hence some trivial operations are needlessly more wordy, or can be more straightforward and might be even more efficient (in-place construction optimisation, ...).Examples
Classic object initialization
Empty object initialization (
{}
)crow::json::wvalue result = crow::json::load("{}");
Proposals
By adding those proposals, object constructor can be more explicit and semantically accurate regarding to syntax.
std::unordered_map<std::string, wvalue>
orstd::map<std::string, wvalue>
,const&
and&&
, constructors and assignements.std::initializer_list<std::pair, wvalue>
contructor and assignment.Is there an interest into those proposals ? May I PR sometime soon ?
The text was updated successfully, but these errors were encountered: