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 }}
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.
This means there is no way to access the container underneath linearly. Deal breaker when you do file IO.
Example code:
TEST_CASE("experimental/mdarray")
{
auto array = std::experimental::mdarray<float, std::experimental::dynamic_extent, std::experimental::dynamic_extent, std::experimental::dynamic_extent>(3, 3, 3);
auto count = 0;
for (auto x = 0; x < 3; ++x)
for (auto y = 0; y < 3; ++y)
for (auto z = 0; z < 3; ++z)
array(x, y, z) = count++;
auto recount = 0;
for (auto i = 0; i < array.size(); ++i)
REQUIRE(array.data()[i] == recount++); // Compile error.
}
Error: C2039 'data': is not a member of 'std::experimental::__mdarray_version_0::vector_container_policy<T,std::allocator>' array_test C:\development\source\cpp\particle_tracer\build\vcpkg\installed\x64-windows\include\experimental__p1684_bits\basic_mdarray.hpp 387
When changed to array.view().data()[i] error becomes: C2248 'std::experimental::__mdarray_version_0::basic_mdarray<float,std::experimental::extents<-1,-1,-1>,std::experimental::layout_right,std::experimental::_mdarray_version_0::vector_container_policy<T,std::allocator>>::map': cannot access private member declared in class 'std::experimental::__mdarray_version_0::basic_mdarray<float,std::experimental::extents<-1,-1,-1>,std::experimental::layout_right,std::experimental::__mdarray_version_0::vector_container_policy<T,std::allocator>>' array_test C:\development\source\cpp\particle_tracer\build\vcpkg\installed\x64-windows\include\experimental__p1684_bits\basic_mdarray.hpp 75
The text was updated successfully, but these errors were encountered:
Hey there! This is probably just a bug in my implementation; our mdarray implementation is not up to the production standards of our mdspan implementation. As specified in the proposal (wg21.link/p1684r0), the data() member should be accessible and should do what you want here. There's also the view().span() that should give you a std::span for linear access, though note that mdspan (and, subsequently, mdarray) specializations are not required to have contiguous or uniquely mapped underlying memory, which is why linear access doesn't make much sense in a generic context. In non-generic context, the problem becomes much easier because you can just interact with whatever concrete data structure that's being used for storage (which you know about directly in a non-generic context) rather than dealing with accessing it through mdarray or (especially) mdspan. But since generic use cases are the priority here (in particular, because the concrete use cases are much easier to deal with), this isn't a point of emphasis.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This means there is no way to access the container underneath linearly. Deal breaker when you do file IO.
Example code:
Error: C2039 'data': is not a member of 'std::experimental::__mdarray_version_0::vector_container_policy<T,std::allocator>' array_test C:\development\source\cpp\particle_tracer\build\vcpkg\installed\x64-windows\include\experimental__p1684_bits\basic_mdarray.hpp 387
When changed to
array.view().data()[i]
error becomes: C2248 'std::experimental::__mdarray_version_0::basic_mdarray<float,std::experimental::extents<-1,-1,-1>,std::experimental::layout_right,std::experimental::_mdarray_version_0::vector_container_policy<T,std::allocator>>::map': cannot access private member declared in class 'std::experimental::__mdarray_version_0::basic_mdarray<float,std::experimental::extents<-1,-1,-1>,std::experimental::layout_right,std::experimental::__mdarray_version_0::vector_container_policy<T,std::allocator>>' array_test C:\development\source\cpp\particle_tracer\build\vcpkg\installed\x64-windows\include\experimental__p1684_bits\basic_mdarray.hpp 75The text was updated successfully, but these errors were encountered: