如何将 mat 类型转换为 fmat。我的功能之一是返回 mat。但是为了记忆,我想将其转换为 fmat。我怎样才能输入它?
mat A = my_function();
fmat B = conv_to<fmat>::from(A);
fmat C = conv_to<fmat>::from(my_function());
Run Code Online (Sandbox Code Playgroud)
或者,您可以将函数更改为模板;例如:
template <typename T>
Mat<T> other_function() {
return Mat<T>(4,4);
}
...
fmat D = other_function<float>();
mat F = other_function<double>();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3200 次 |
| 最近记录: |