pb_ds(<ext/pb_ds/assoc_container.hpp>
和其他 4 个头文件)是用于某些数据结构(例如红黑树)的 GNU C++ 库。我遇到了修改树时应用更新的代码:
PB_DS_CLASS_T_DEC
template<typename Node_Update_>
inline void
PB_DS_CLASS_C_DEC::
apply_update(node_pointer p_nd, Node_Update_* /*p_update*/)
{
node_update::operator()(node_iterator(p_nd),
node_const_iterator(static_cast<node_pointer>(0)));
}
其中node_update
类具有以下形式:
template<class Node_CItr,class Node_Itr,class Cmp_Fn,class _Alloc>
struct my_node_update
{
typedef my_type metadata_type;
void operator()(Node_Itr it, Node_CItr end_it)
{
//...
}
};
node_update::operator()...
我对我认为从类中调用非静态成员函数node_update
但没有创建对象的代码感到困惑。那么通话是如何进行的呢?