Matlab bindings: fixed the functional template to perform an explicit cast to the type of an input option that is expected. This avoids issues with ternary operator not having the same type in rvalue and lvalue, such as in the case below:

Ptr_FeatureDetector blobDetector = inputs[3].empty() ? makePtr<SimpleBlobDetector>() : inputs[3].toPtrFeatureDetector();

Which after the patch, would be:

Ptr_FeatureDetector blobDetector = inputs[3].empty() ? (Ptr_FeatureDetector) makePtr<SimpleBlobDetector>() : inputs[3].toPtrFeatureDetector();
This commit is contained in:
Rok Mandeljc 2014-04-28 15:43:12 +02:00
parent 2d47dd7038
commit fa075c50a1

View File

@ -110,7 +110,7 @@ addVariant("{{ fun.name }}", {{ fun.req|inputs|length }}, {{ fun.opt|inputs|leng
{{arg.tp}} {{arg.name}} = inputs[{{ loop.index0 }}].to{{arg.tp|toUpperCamelCase}}();
{% endfor %}
{% for opt in fun.opt|inputs %}
{{opt.tp}} {{opt.name}} = inputs[{{loop.index0 + fun.req|inputs|length}}].empty() ? {% if opt.ref == '*' -%} {{opt.tp}}() {%- else -%} {{opt.default}} {%- endif %} : inputs[{{loop.index0 + fun.req|inputs|length}}].to{{opt.tp|toUpperCamelCase}}();
{{opt.tp}} {{opt.name}} = inputs[{{loop.index0 + fun.req|inputs|length}}].empty() ? ({{opt.tp}}) {% if opt.ref == '*' -%} {{opt.tp}}() {%- else -%} {{opt.default}} {%- endif %} : inputs[{{loop.index0 + fun.req|inputs|length}}].to{{opt.tp|toUpperCamelCase}}();
{% endfor %}
{# ----------- Outputs ------------ #}
{% for arg in fun.req|only|outputs %}