我有一个工作的Spirit-X3分析器,它可以解析两个紧密相关的语法来设置草稿和检查器位置。我定义了两个可变模板特作为解析器语法的两种方言: // general variable template
template<class Format>
auto const position = []{};
// template specialization for algebraic nota
以下代码: /tmp/ccuciovi.o: In function `double fun<double>(double)':
gcc-bug.cpp:(.text._Z3funIdET_S0_[_Z3funIdET_S0_]+0xd): undefined reference to `foo<double>'
collect2: error: ld returned 1 exit stat
是否可以在内联constexpr函数内使用变量模板而不暴露变量模板本身? 例如,该编译和工作原理: template<typename T> constexpr T twelve_hundred = T(1200.0);
template<typename T>
inline constexpr T centsToOctaves(const T cents) {
return ce