【发布时间】:2014-12-11 05:05:52
【问题描述】:
我有课。类有一个结构_tree_branch_m 和一个类成员函数。该结构是成员函数的参数。在成员函数内部,访问结构成员时出错。我的结构有什么问题?错误是Field 'NodeType' 无法解决。
class CascadeClassifier{
protected:
typedef char *Set_m;
typedef struct _tree_branch_m *Tree_m;
struct _tree_branch_m
{
short NodeType; /* 0=leaf 1=branch 2=cut 3=subset */
short Leaf; /* most frequent class at this node */
float Items, /* no of items at this node */
*ClassDist, /* class distribution of items */
Errors; /* no of errors at this node */
short Tested; /* attribute referenced in test */
short Forks; /* number of branches at this node */
float Cut, /* threshold for continuous attribute */
Lower, /* lower limit of soft threshold */
Upper; /* upper limit ditto */
Set_m *Subset; /* subsets of discrete values */
Tree_m *Branch; /* Branch[x] = (sub)tree for outcome x */
};
virtual void ClassifyCase(Tree_m subtree, float Weight, float *LowClassSum, float *ClassSum);
};
void CascadeClassifier::ClassifyCase(Tree_m Subtree, float Weight, float *LowClassSum, float *ClassSum)
{
if ( ! Subtree->NodeType )//error
{
}
}
【问题讨论】:
-
究竟是什么错误?在哪一行?
-
如果您在问题中使用了错误一词,请在问题中包含它。
-
这是不可重现的,请提供MCVE。
-
@jogojapan,这没关系,因为当他在函数参数中时,他已经在类的命名空间中。这只对前导返回类型很重要(但不是尾随类型,这就是它们存在的原因。)
-
抱歉添加了错误信息。错误是无法解析字段“NodeType”。谢谢