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
introduce the trait is_fixed_array, which is true for types defining iterators, operator[] AND the field static_size
refine the trait is_vector, by adding the test on having defined the function resize() (not foolproof but should be sufficient)
implement R/W AccessorFixedArray for the container having the trait is_fixed_array
add templated tests for those accessors
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
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
is_fixed_array
, which is true for types defining iterators, operator[] AND the field static_sizeis_vector
, by adding the test on having defined the functionresize()
(not foolproof but should be sufficient)is_fixed_array
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