gpt4 book ai didi

c++ - 尖括号被解释为模板函数中的模板类型

转载 作者:行者123 更新时间:2023-11-30 04:19:19 28 4
gpt4 key购买 nike

modes_[pos].variance = (sigmanew < 4) ? (4) : sigmanew > 5 * variance_ : sigmanew;

我在模板类的模板函数中有一行。此行中的尖括号被解释为数据类型定义并抛出错误。我该如何解决此类问题?

错误是:

/(foldername)/(part_filename)_templated_impl.tpp:312:89: error: found ':' in nested-name-specifier, expected '::'

/(foldername)/(part_filename)_templated_impl.tpp:312:79: error: 'variance_' is not a class or namespace

最佳答案

我认为 < 没有任何问题或 > .您的三元运算符中有两个冒号。那可能是不对的。看起来你正在尝试的是:

modes_[pos].variance = (sigmanew < 4) ? (4) 
: (sigmanew > 5) ? variance_
: sigmanew;

但是您输错了其中一个 ?秒。为什么不在多行上执行此操作,而不是尝试以这种方式将它们全部塞在一起?

关于c++ - 尖括号被解释为模板函数中的模板类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15913243/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com