@@ -45,23 +45,23 @@ void processAttribute(const std::string& attrname, // input, attribute name
45
45
if (valtype == matlab::data::ArrayType::DOUBLE) {
46
46
matlab::data::TypedArray<double > attrvalue_mda = attrvalue;
47
47
attrs.Attributes .push_back (std::pair<std::string, common::AttributeValue>(attrname,
48
- nostd::span<const double >{&(*attrvalue_mda.cbegin ()), &(* attrvalue_mda.cend () )}));
48
+ nostd::span<const double >{&(*attrvalue_mda.cbegin ()), attrvalue_mda.getNumberOfElements ( )}));
49
49
} else if (valtype == matlab::data::ArrayType::INT32) {
50
50
matlab::data::TypedArray<int32_t > attrvalue_mda = attrvalue;
51
51
attrs.Attributes .push_back (std::pair<std::string, common::AttributeValue>(attrname,
52
- nostd::span<const int32_t >{&(*attrvalue_mda.cbegin ()), &(* attrvalue_mda.cend () )}));
52
+ nostd::span<const int32_t >{&(*attrvalue_mda.cbegin ()), attrvalue_mda.getNumberOfElements ( )}));
53
53
} else if (valtype == matlab::data::ArrayType::UINT32) {
54
54
matlab::data::TypedArray<uint32_t > attrvalue_mda = attrvalue;
55
55
attrs.Attributes .push_back (std::pair<std::string, common::AttributeValue>(attrname,
56
- nostd::span<const uint32_t >{&(*attrvalue_mda.cbegin ()), &(* attrvalue_mda.cend () )}));
56
+ nostd::span<const uint32_t >{&(*attrvalue_mda.cbegin ()), attrvalue_mda.getNumberOfElements ( )}));
57
57
} else if (valtype == matlab::data::ArrayType::INT64) {
58
58
matlab::data::TypedArray<int64_t > attrvalue_mda = attrvalue;
59
59
attrs.Attributes .push_back (std::pair<std::string, common::AttributeValue>(attrname,
60
- nostd::span<const int64_t >{&(*attrvalue_mda.cbegin ()), &(* attrvalue_mda.cend () )}));
60
+ nostd::span<const int64_t >{&(*attrvalue_mda.cbegin ()), attrvalue_mda.getNumberOfElements ( )}));
61
61
} else if (valtype == matlab::data::ArrayType::LOGICAL) {
62
62
matlab::data::TypedArray<bool > attrvalue_mda = attrvalue;
63
63
attrs.Attributes .push_back (std::pair<std::string, common::AttributeValue>(attrname,
64
- nostd::span<const bool >{&(*attrvalue_mda.cbegin ()), &(* attrvalue_mda.cend () )}));
64
+ nostd::span<const bool >{&(*attrvalue_mda.cbegin ()), attrvalue_mda.getNumberOfElements ( )}));
65
65
} else if (valtype == matlab::data::ArrayType::MATLAB_STRING) { // string
66
66
matlab::data::StringArray attrvalue_mda = attrvalue;
67
67
std::vector<nostd::string_view> strarray_attr;
@@ -73,7 +73,7 @@ void processAttribute(const std::string& attrname, // input, attribute name
73
73
}
74
74
attrs.StringViewBuffer .push_back (strarray_attr);
75
75
attrs.Attributes .push_back (std::pair<std::string, common::AttributeValue>(attrname,
76
- nostd::span<const nostd::string_view>{&(*attrs.StringViewBuffer .back ().cbegin ()), &(*attrs. StringViewBuffer . back (). cend () )}));
76
+ nostd::span<const nostd::string_view>{&(*attrs.StringViewBuffer .back ().cbegin ()), attrvalue_mda. getNumberOfElements ( )}));
77
77
} else { // ignore all other types
78
78
return ;
79
79
}
@@ -85,8 +85,7 @@ void processAttribute(const std::string& attrname, // input, attribute name
85
85
}
86
86
attrs.DimensionsBuffer .push_back (attrvalue_dims_buffer);
87
87
attrs.Attributes .push_back (std::pair<std::string, common::AttributeValue>(sizeattr,
88
- nostd::span<const double >{&(*attrs.DimensionsBuffer .back ().cbegin ()),
89
- &(*attrs.DimensionsBuffer .back ().cend ())}));
88
+ nostd::span<const double >{attrs.DimensionsBuffer .back ().data (), attrvalue_dims_buffer.size ()}));
90
89
}
91
90
}
92
91
} // namespace
0 commit comments