【发布时间】:2016-03-30 01:10:02
【问题描述】:
我无法调用所有注册时钟的订阅者的 negedge,所有订阅者也都从 ClkIf 派生
class ClkAdapter : public ClkIf
{
virtual void negedge()
{
for(std::list<ClkIf*>::iterator it = clk_list.begin(); it != clk_list.end(); it++)
(it->negedge)();
}
virtual void posedge()
{ clk_cnt++; }
void registerForClock(ClkIf* module)
{ clk_list.push_back(module); }
std::list<ClkIf*> clk_list;
unsigned long long clk_cnt;
};
错误:在 '* it.std::_List_iterator<_tp>::operator-> 中请求成员 'negedge',带有 _Tp = ClkIf*',它属于非类类型 'ClkIf*' negedge 函数出错,这段代码有什么问题?
【问题讨论】:
标签: vector interface stl derived-class base-class