-
Notifications
You must be signed in to change notification settings - Fork 403
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
Add JSON serialization and deserialization of xtensor containers #830
Conversation
detail::json_shape(j, s); | ||
|
||
// In the case of a view, we check the size of the container. | ||
if (!std::equal(s.cbegin(), s.cend(), e.shape().cbegin())) |
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.
maybe we should factor this out, like in xt::resize_container
and make a xt::resize_expression
free function, that resizes in the case of a container_semantic and throws if shape is wrong in case of view_semantic?
Could be useful for other cases in the future.
d04365a
to
ac8bded
Compare
include/xtensor/xjson.hpp
Outdated
enable_xcontainer<E> from_json(const nlohmann::json&, E&); | ||
|
||
template <class E> | ||
enable_xview<E> from_json(const nlohmann::json&, E&); |
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.
Should we call this enable_xview_semantics
instead? (idem for containers)
Added some documentation. Despite |
OK, the documentation issue is fixed. This is ready to go IMO. |
No description provided.