Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
13bc3880
Commit
13bc3880
authored
Apr 12, 2016
by
Davis King
Browse files
Fixed compiler errors when using std::vector in mex wrapper.
parent
61591b13
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
16 deletions
+25
-16
dlib/matlab/mex_wrapper.cpp
dlib/matlab/mex_wrapper.cpp
+25
-16
No files found.
dlib/matlab/mex_wrapper.cpp
View file @
13bc3880
...
...
@@ -341,6 +341,15 @@ namespace mex_binding
std
::
string
msg
;
};
// -------------------------------------------------------
template
<
typename
T
>
void
validate_and_populate_arg
(
long
arg_idx
,
const
mxArray
*
prhs
,
T
&
arg
);
// -------------------------------------------------------
template
<
typename
T
>
...
...
@@ -1075,22 +1084,6 @@ namespace mex_binding
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
>
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
(
...
...
@@ -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
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment