Skip to content
This repository was archived by the owner on Sep 18, 2024. It is now read-only.
This repository was archived by the owner on Sep 18, 2024. It is now read-only.

The array.data() and array.view().data() are inaccessible. #3

@acdemiralp

Description

@acdemiralp

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions