Changed bad cast in MxArray

This commit is contained in:
hbristow 2013-08-12 11:38:59 +10:00
parent fb41d7bf4e
commit ef2c1e1a24

View File

@ -406,13 +406,12 @@ public:
const Scalar* imag() const { return static_cast<const Scalar *>(mxGetData(ptr_)); } const Scalar* imag() const { return static_cast<const Scalar *>(mxGetData(ptr_)); }
template <typename Scalar> template <typename Scalar>
Scalar scalar() const { return static_cast<double *>(mxGetData(ptr_))[0]; } Scalar scalar() const { return static_cast<Scalar *>(mxGetData(ptr_))[0]; }
std::string toString() const { std::string toString() const {
conditionalError(isString(), "Attempted to convert non-string type to string"); conditionalError(isString(), "Attempted to convert non-string type to string");
std::string str(size()+1, '\0'); std::string str(size()+1, '\0');
mxGetString(ptr_, const_cast<char *>(str.data()), str.size()); mxGetString(ptr_, const_cast<char *>(str.data()), str.size());
mexPrintf("string: %s\n", str.c_str());
return str; return str;
} }