Commit 13bc3880 authored by Davis King's avatar Davis King

Fixed compiler errors when using std::vector in mex wrapper.

parent 61591b13
...@@ -341,6 +341,15 @@ namespace mex_binding ...@@ -341,6 +341,15 @@ namespace mex_binding
std::string msg; std::string msg;
}; };
// -------------------------------------------------------
template <typename T>
void validate_and_populate_arg (
long arg_idx,
const mxArray *prhs,
T& arg
);
// ------------------------------------------------------- // -------------------------------------------------------
template <typename T> template <typename T>
...@@ -1075,22 +1084,6 @@ namespace mex_binding ...@@ -1075,22 +1084,6 @@ namespace mex_binding
assign_to_matlab(plhs,array_to_matrix(item)); assign_to_matlab(plhs,array_to_matrix(item));
} }
template <typename T>
typename dlib::enable_if<is_array_type<T> >::type assign_to_matlab(
mxArray*& plhs,
const T& item
)
{
mwSize dims[1] = {item.size()};
plhs = mxCreateCellArray(1,dims);
for (unsigned long i = 0; i < item.size(); ++i)
{
mxArray* next = 0;
assign_to_matlab(next, item[i]);
mxSetCell(plhs, i, next);
}
}
template <typename T> template <typename T>
typename dlib::disable_if_c<is_matrix<T>::value || is_array_type<T>::value || typename dlib::disable_if_c<is_matrix<T>::value || is_array_type<T>::value ||
is_same_type<T,function_handle>::value>::type assign_to_matlab( is_same_type<T,function_handle>::value>::type assign_to_matlab(
...@@ -1117,6 +1110,22 @@ namespace mex_binding ...@@ -1117,6 +1110,22 @@ namespace mex_binding
{ {
} }
template <typename T>
typename dlib::enable_if<is_array_type<T> >::type assign_to_matlab(
mxArray*& plhs,
const T& item
)
{
mwSize dims[1] = {item.size()};
plhs = mxCreateCellArray(1,dims);
for (unsigned long i = 0; i < item.size(); ++i)
{
mxArray* next = 0;
assign_to_matlab(next, item[i]);
mxSetCell(plhs, i, next);
}
}
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
template <typename T> template <typename T>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment