Access to data buffer in TypeInfo_FixedArray.h (`&data[0]`)
I open this issue following a PR on VectorTypeInfo.
The initial PR purpose was to change the default behaviour of the getValuePtr methods from
return &data[0];
(which may lead to problems when dealing with an empty vector), to :
return data.data();
I found this behaviour in two other 'type info' files: TypeInfo_Text.h and FixedArrayTypeInfo.h, but I couldn't apply the same fix to FixedArrayTypeInfo, which involves, at some point, RigidCoord and RigidDeriv data (which don't have a .data() method), leading to this error at build:
FixedArrayTypeInfo.h:195:21: error: ‘const DataType’ {aka ‘const class sofa::defaulttype::RigidDeriv<2, double>’} has no member named ‘data’
195 | return data.data();
| ~~~~~^~~~
I guess it would be a good thing to remove all occurrences of this kind of &data[0] in the code, but I'm not sure I will find the time to investigate on what would be a proper replacement for TypeInfo_FixedArray.h.
@alxbilger did you fixed this issue in PR #3512, can we close it?
@epernod No I don't think the PR #3512 fixed this specific issue