sofa-framework / sofa

Real-time multi-physics simulation with an emphasis on medical simulation.
https://www.sofa-framework.org
GNU Lesser General Public License v2.1
934 stars 312 forks source link

[Helper] Add Accessors for Array types #5114

Open fredroy opened 1 week ago

fredroy commented 1 week ago

Array as in fixed_array, not std::array or []

It appeared that it was not possible to get a R/W Accessor on sofa::type::fixed_array, because it was not defined the alias/type "T::Size". After investigation, everything defining operator[] and iterators can use R/W AccessVector. This is not correct because WriteAccessor defines resize/push_back (dynamic allocation API) and some of this types do not support it (fixed_array, type::Vec, Mat, etc). So in the current state, you are able to call resize on an accessor of type::Vec, but it fails obviously to compile.

So this PR

A bit breaking because of the change in is_vector, and the fact that RWAccessor (and other) will be a RWAccessorFixedArray, not a RWAcessorVector anymore


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

fredroy commented 1 week ago

[ci-build][with-all-tests]