c++ - What does .template do?
问题描述
I have a few lines of code like this:
ac_fixed<Wfl, Ifl, true> input_mant;
// Set the sign bit to zero to ensure a positive value.
input_mant[Wfl - 1] = 0;
// Set the bit adjacent to the sign bit to 1 to ensure a normalized mantissa
input_mant[Wfl - 2] = 1;
// Set the remaining bits to the bit pattern stored in the last (Wfl - 2) bits in mant_i.
input_mant.template set_slc(0, mant_i.template slc<Wfl - 2>(0)); // <<< SYNTAX ERROR: 'template'
In which ac_fixed type is defined as:
template<int W, int I, bool S=true, ac_q_mode Q=AC_TRN, ac_o_mode O=AC_WRAP>
class ac_fixed : private ac_private::iv<(W+31+!S)/32>
#ifndef __SYNTHESIS__
__AC_FIXED_UTILITY_BASE
#endif
#ifdef __AC_FIXED_NUMERICAL_ANALYSIS_BASE
, public __AC_FIXED_NUMERICAL_ANALYSIS_BASE
#endif
... (a lot more skipped)
During compiling, the line input.mant_template has "syntax error: 'template'". I don't know what .template does in this case and why it has a syntax error? And not sure where to look inside ac_fixed definition. The files are from the Algorithmic C HLS library in case a full visibility is needed.
解决方案
推荐阅读
- outlook - 是否可以使用 Microsoft Graph API 查询约会自定义表单数据?
- python - 从单独的文件中调用字符串
- vue.js - Vue.js 和 Codenvy?
- wordpress - 带有用于 wordpress 的旋转滑块的 divi 主题中的透明菜单
- r - 如何计算多维平均矩阵?
- sql - 创建远程外部表
- rundeck - Rundeck - 在 5.8k 节点上运行时任何命令执行都会失败
- android - 如果回收站视图项中的数据为空,则不显示视图持有者
- ios - Swift and Sprite Kit - 我如何测量一个精灵行进的总距离?
- mongodb - Monoose DeprecationWarning collection.ensureIndex 和 useNewUrlParser